2
\$\begingroup\$

I was working with an Arduino One and this rotary encoder from SparkFun. Then, for no good reason, I put three pull-up resistors, one for each input pin (pin 2, 3 & 4) facing the encoder, like this (only pin 4 is show because small drawing space):

Rotary Encoder with ext. pull-up resistor

But then I got all kind of problems. Sometimes I could not read the encoder, sometimes I got the push-button pin firing when I just rotate the shaft, sometimes it works randomly, etc. (It's seem to me that behavior was fixed at boot time).

I eliminated the three resistors, and all returns to normal, but, as far I know, this encoder is a simple one; just three switches. I think this is the correct equivalent circuit (just for one pin, the same for the other two):

Internal + External pull-up resistor

So, what I'm doing wrong? Did I misunderstand the encoder?

Notes:

  1. My circuits/sketch is working fine. I can read the encoder & push-button.
  2. I'm not using interrupts, just polling in a timer fired routine, at 5-10 ms intervals.
  3. I tested it with internal pull-up on and off.
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Making external pullup when you have internal one is a normal practice, because internal pullup often is weak. Did you try to work without external pullup? Did you try sketch from Sparkfun? Also it's unclear if you've tried to disable internal pullup and what you mean by (2,3,4) pins? \$\endgroup\$
    – Looongcat
    Sep 11, 2015 at 11:14
  • \$\begingroup\$ The Schematic you posted should work as long as both or either one of the resistors is/are activated/attached. If you use both resistors, they are effectively in parallel, reducing the overall resistance. But that should still work for that kind of circuit where you pull down to GND very "hard" (mechanical switch). You are not specific enough with the analysis of your potential problem: "sometimes it almost works" \$\endgroup\$
    – Rev
    Sep 11, 2015 at 11:18
  • \$\begingroup\$ From what you describe it almost seems like something went wrong while wiring the external pull-ups and somehow all the encoder switches ended hardwire OR'd and depeding on the polling order, the state of encoder upon power-up you would get all sorts of random behaviors. I would retry the external pull ups, wiring one at time. \$\endgroup\$
    – Kvegaoro
    Sep 11, 2015 at 17:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.