-1

When would one would prefer to use an external pull-up resistor vs the internal:

pinMode(fanPin, INPUT_PULLUP);

Dredging through the forums and this site, the commonly recommended value for a pull-up resistor is seems to fall at 10K.

However, the ATmega32U4 datasheet's Table 29-1 says that RPU or "I/O Pin Pull-up Resistor" is between 20K and 50K ohms.

This question asks about internal vs external pull-ups for a simple button, but I'm asking in the general case.

What types of projects would fare better with internal pull-ups, and what type of projects would be better off with external pull-ups?

What are the considerations for preferring one over the other?

At the present, my project is hooking up an AM2302 / DHT22 temperature sensor.

  • 3
    Whats OUTPUT_PULLUP? Pulling an output high doesn't make a lot of sense. – tkausl Feb 12 at 10:29
  • I2C requires lower value pull-up resistors, so in that case you'd need external resistors. High noise environments could accidentally trigger an input if the pull-up is weak. But in most cases the internal pull-up is fine. And it's cheaper to not add a resistor, especially in very high volume manufacturing. – Gerben Feb 12 at 11:04
  • During manufacturing they sometimes change the value of the pull-up to a value resistor that is already on the board. Reducing the setup cost. – Gerben Feb 12 at 11:06
  • the internals are fine for most things, unless you have semi-low impedance on the sensor's output. Impedance is more than resistance. – dandavis Feb 12 at 20:10
  • @tkausl Thanks for pointing out that OUTPUT_PULLUP doesn't exist. Edited. – Tom Hale Feb 13 at 2:28
3

There is no OUTPUT_PULLUP that I am aware of. Use INPUT_PULLUP for most things.

Add 3.3K (3.3V) or 4.7K (5V) external pullups for I2C. If you saw a 'scope trace with 10K I2C pullup on 5V system and even short wiring, the rise time is really slow. 4.7K is much quicker.

10K for external pullup works well for slow things, like buttons, switches. If the wire lengths are longer, then 4.7K could be used as well, maybe even 1K if the wires are long. If running on battery power, 10K is better as there is less current flow when the input is low.

1

I almost always use external pull up/down resistors. I get more control over the value and can do more in hardware with them, whether that is debouncing buttons or using different types of transistors.

The easiest way to answer your question is to ask what you want to do. If you want active low, use pull up. Active high is pull down. Some transistors work much better with one or the other, so they could determine what you use. I2C uses weak pull ups to bias the transmission lines. If you need hardware filtering its much easier to design a filter with a known 25k resistor than with an unknown 20k-50k resistor. The list could go on an on but those are the most common situations I've run into.

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.