Questions tagged [pull-up]

Refers to pull-up resistors, which are commonly used to "weakly" pull a signal line to a high state. Use this tag for discussing pull-ups.

A pull-up resistor is used to avoid having a pin "float" with undefined voltages, for example:

Pull-up resistor

In this example the Arduino pin is kept at a HIGH level by the resistor. However if the switch is closed the pin becomes LOW.

Generally a high-value resistor (like, 10 k or more, possibly 100 k or even 1 M ohms) is used. When the switch is closed the 5 V line will be connected to Ground via the pull-up resistor, so you don't want too high a current to flow. In the above example the current would be:

I = V / R
I = 5 / 10000
I = 0.5 mA

Open-drain

Pull-up resistors are also used for "open-drain" designs, such as used in I2C. In such designs the data or clock lines are "pulled high" by a pull-up resistor, with multiple devices connected to the bus. When one of them wants to send a 0-bit they drive the line low, overriding the pull-up resistor. To send a 1-bit they let the pull-up resistor bring the line high again.

Doing it this way avoids having multiple devices "fighting" a bus, with some trying to drive it high, and some trying to drive it low.

In the case of I2C a resistor of 4.7 k is commonly used for SDA (serial data) and SCL (serial clock). Thus the I2C devices only have to be able to sink 10.6 mA (5 / 4700) which is usually within their design capabilities.


Internal pull-up

The AVR Arduinos have built-in pull-up capabilities. This lets you design a pull-up into a circuit (such as a switch) without actually having to wire in a resistor.

The internal pull-up is specified for the Atmega328P (as used in the Uno) at being between 30 k and 50 k ohms.

You can activate the pull-up in code like this:

pinMode (3, INPUT_PULLUP);

References

57 questions
6
votes
1 answer

Shift Register w/ Internal Pullups?

Is there a chip that is just a parallel in / serial out shift register but with integrated internal pullups? I could use a full-blown I/O expander but I really just need more momentary button inputs. I don't need outputs and I would rather not…
squarewav
  • 191
  • 5
2
votes
4 answers

Testing tri-state pin - erroneous results with internal pullup

I'm using an MPC73831 - a LiPo charging IC - in my Arduino project. It has a status pin to allow interface to a microcontroller, which uses a tri-state operation to convey three possible states of charging. I don't have the IC and battery yet, but I…
CharlieHanson
  • 1,400
  • 1
  • 11
  • 25
1
vote
1 answer

Will I need the internal pullup resistor if no button is used?

Given I have two Arduinos that are supposed to primitively communicate with each other using digital pins. On Arduino Ar1, pin D13 is to be used as an input, connected to Ar2's D2 pin. Will I need to use the internal pullup resistor of Ar1 on pin…
Mikoyan
  • 33
  • 4
1
vote
3 answers

External vs internal pullup

There are two ways of pulling the pins in Arduino – using internal and external resistor. I wonder when I should use external resistor instead of INPUT_PULLUP.
zhekaus
  • 439
  • 2
  • 6
  • 16
1
vote
2 answers

Using an external pull-up resistor vs INPUT_PULLUP

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…
Tom Hale
  • 431
  • 6
  • 19