# Using Pullup and Pulldown Resistors

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...

...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.

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.

• 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. – uɐɪ Oct 4 '10 at 12:13
• 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. – Kortuk Oct 4 '10 at 14:19
• 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? – Mr. Hedgehog Oct 4 '10 at 15:45
• 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. – Adam Lawrence Oct 4 '10 at 16:40
• @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. – JustJeff Oct 5 '10 at 2:44

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}}$$