30

I have come across many simple circuits that show how to switch on an LED or something else. Pull up resistors are often mentioned. What do they do? Some GPIO pins require pull up resistors and others do not, what is the difference?

3

5 Answers 5

13

From the Arduino website:

Often it is useful to steer an input pin to a known state if no input is present. This can be done by adding a pullup resistor (to +5 V), or a pull-down resistor (resistor to ground) on the input, with 10 kΩ being a common value.

BUT: That is from the Arduino website. Remember that Raspberry GPIO pins are only 3.3 V tolerant (so, do the pullup to 3.3 V, not 5 V on the Raspberry Pi)!!!

Here's an example of a pull-up resistor schematics.

an example

A pull-up will make sure the pin is up without taking in too much current. A gate has three possible states: ON, OFF and FLOATING.

The FLOATING state is not very useful since it can't be converted to a boolean value. Hence pull-up and pull-down resistors: they are there to eliminate the FLOATING state.

2
  • 3
    Technically FLOATING is not a logical state but a loose technical term used to describe that it is unconnected and may receive random combinations of HIGH/LOW caused by static discharge noise generated by nearby objects. There is no logical variable for floating, except the mathematical number. Digital is either 1 or 0.
    – Piotr Kula
    Aug 2, 2014 at 14:52
  • When the question votes are that higher than the best answer's votes it means there is space for better explanation. Jan 30, 2021 at 21:04
9

A pull-up or pull-down resistor are used on input pins to define a state in the case an input does not have anything connected or the connected part is in the high impedance (Z) state. Inputs without a defined state have the problem that the input value can be anything (0 or 1), called floating.

This is explained in more depth in the article on Wikipedia (that Jivings added to the comments of your question), and a little more visually in this article on SparkFun.

1
  • The sparkfun description is brilliant compared to Wikipedia a makes far fewer assumptions about a readers knowledge Jan 19, 2013 at 10:36
3

Something to keep in mind (confused me a bit at first) is that a pull-up or pull-down resistor is just a standard resistor in a specific role. More than one person has tried to buy pull-up resistors only to find they don't exist. Otherwise it is just as it sounds, a standard resistor pulling the voltage up to 5V/3.3V or down to 0V as the normal state.

1
  • 1
    Part of what's confusing here is it isn't really the resistor doing the "pull-up" -- the pull up is what on the other side of the resistor. The resistor is just control the current flow through through the pull-up. raspberrypi.stackexchange.com/questions/28973/…
    – goldilocks
    Apr 22, 2015 at 17:56
2

The term pull-up or pull-down is a term used to describe the role a resistor is performing. It pulls the signal line that it is connected to on one terminal towards the Supply/Ground/Reference Voltage that is present on the other terminal. The previous answer is incorrect in saying ¨it pulls up the impedance¨ rather it is to reduce the resistance/impedance in the circuit so that the line assumes a known state when it will not otherwise e.g. an input pin on a integrated circuit that is otherwise not connected. As this will counter the effects when something external is connected the amount of the resistance is required to be low enough to be effective to do the pulling if the pin is accidentally or deliberately left open circuit but high enough that any external circuit is not unduly burdened to overcome the effect when it wants to drive the line in the other direction.

The GPIO Pins on the Pi have controllable internal ones which I understand can mostly be made to make the lines assume a logical low or high or left open circuit - the latter of which is fine if there is a user provided pull up/down resistor to do the job (possibly as part of the external circuity anyway). The design of latter is particularly significant if the external circuit is running from supply rails in excess of 3.3 Volts because in that case the pull-up must not try to raise the voltage on the line to above 3.3V - a series resistor (say 4K7) and a Schottky diode (e.g. a BAT85) with its anode to the side of the series resistor connected to the GPIO pin and its cathode to the 3.3V supply rail is one way to prevent this - the low ( < 0.2V ) forward voltage drop of that type of diode prevents the signal line being taken high enough to damage the Pi, at the expense of a slightly increased time for signals to propagate into the Pi.

I´m just starting out with Pi's as I bought two second-hand yesterday {though I've been into electronics for over 35 years} and I'm looking around for information about the Pi's Pinout for exactly this reason - and for the best place to get two PSUs as they didn´t come with 'em. 8-P

1

The electronics dictionary defines pull-up as follows:

pull-up: Descriptive of a circuit or component used to raise the value (e.g., impedance) of a circuit to which it is connected.

If an LED is connected to a +5 V power supply and is controlled (LED ON & OFF) by a microcontrollers/microprocessor or by some other means, during ON state the power-supply may supply high current, in turn high current may damage the LED.

To limit the high current from the supply, a pull-up resistor, pulls up the impedance and limits the current supplying the LED from the power supply (+5 V). Hence the LED is protected form high currents. Based on the circuit, a pull-up function varies and form protection to wired AND logic to an I²C bus.

1
  • 1
    @SlySven has it right - this answer is not correct, electronically speaking. AFAIK there is no concept in electronics of "pulling up the impedance". In the context of logic circuits, a pull-up resistor REDUCES the impedance, and in so doing influences the voltage where it is connected, usually towards a positive voltage (hence the 'up' in pull-up, you can also have a pull-down, usually to 0V). The resistor in series with an LED is simply determining the current that can flow through the LED - this is in no way related to a pull-up even though the schematic might look similar. Dec 7, 2016 at 10:18

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.