5
\$\begingroup\$

I've been researching pullup and pulldown resistors after seeing them used in many digital circuits and while I understand what their purpose is, I haven't found any resource on how to determine the resistance values to use in such circuits and how these values affect the circuit's behaviour.

One of the examples I have is...

ADC Keypad Circuit

...which is an A/D converter circuit for a keypad input. I have implemented this and it actually works very well but I can't quite pinpoint why a 1Mohm resistor was picked as the pullup and what exactly happens to it when one of the buttons are pressed - does it affect the voltage of the ADC input in such a small amount that it doesn't register or is it overridden somehow or...?

I know this is probably a very basic question but I can't seem to apply the thoery I have learned to this one.

\$\endgroup\$
2

2 Answers 2

15
\$\begingroup\$

That 1M is there just to make sure that the ADC input pin isn't totally free-floating, and also gives a known voltage (+5) when no switches are pressed. This keeps the ADC from picking up ambient noise from the rest of the circuit.

The reason for the value of 1M is a compromise between a value low enough to keep the ADC input from acting like an antenna, and a value high enough to not overly skew the result you get when a switch is pressed. When a switch is pressed, that 1M is in parallel with the 'top half' of a voltage divider formed by the 1K resistors either side of the switch.

\$\endgroup\$
7
  • 6
    \$\begingroup\$ The other side of the compromise is that the resistor values are kept "reasonably" high so that the current and hence power dissipated through the resistor chain is kept small. They could all be made 1R in value but this would waste 1.4 watts compared to the 0.14mW in the chain above. \$\endgroup\$
    – uɐɪ
    Commented Oct 4, 2010 at 12:13
  • \$\begingroup\$ that 1M should pull you to 5V. If you have too large a leakage current for your ADC, which is common, then it can still be pulled somewhere other than 5V. it is for power reasons that it is 1M. Justjeff, I do not know what you mean by antenna, I am 90% sure that the resistance has nothing to do with it being an antenna. \$\endgroup\$
    – Kortuk
    Commented Oct 4, 2010 at 14:19
  • \$\begingroup\$ So the 1M resistor wouldn't divide the voltage at ADC to 0V? Does that mean the voltage dividing rule only applies when there are multiple loads in series? \$\endgroup\$ Commented Oct 4, 2010 at 15:45
  • 1
    \$\begingroup\$ The 1M resistor creates a voltage divider with the input impedance of the ADC input pin. If the input impedance is quite high (tens of megohms) then the 1M pull-up becomes insignificant. The fact that there's a small drop across the 1M is not likely important as if the ADC is also powered from +5, there's probably a dead band on the high-side a few hundred millivolts below the supply rail. \$\endgroup\$ Commented Oct 4, 2010 at 16:40
  • \$\begingroup\$ @Kortuk - what I meant by 'antenna' is that when you have a floating input pin, especially one that's a high impedance input like an op-amp, it tends to pick up noise from adjacent circuitry, acting a bit like an antenna. If you load that pin with a resistor to an AC ground (the +5 rail is an AC ground), it attenuates that stuff. \$\endgroup\$
    – JustJeff
    Commented Oct 5, 2010 at 2:44
2
\$\begingroup\$

Suppose we label the first switch num=1, the last switch num=16, then:

$$R_{hi} = \frac{1M\Omega \times num \times 10k\Omega}{1M\Omega + num \times 10k\Omega}$$ $$R_{lo} = (17 - num) \times 10k\Omega$$ $$V_{out} = \frac{5V \times R_lo}{R_{hi} + R_{lo}}$$

\$\endgroup\$

Your Answer

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

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