NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » pull up, pull down resistors

July 04, 2009
by sgmaniac1255
sgmaniac1255's Avatar

simple question, although it may become complex later as i try to broaden my understanding.

i understand the function of a pull up or pull down resistor, pull up increases the voltage at a node and a pull down decreases the voltage

however, what i fail to understand is how pull up and pull down resistors accomplish this task

July 05, 2009
by BobaMosfet
BobaMosfet's Avatar

sgmaniac1255--

Like you, I struggled with this for a while. Here is the best explanation I can give.

Whether pull-up or pull-down, there is no difference. The resistor is necessary for 2 reasons only:

  1. If a pull-up resistor is being used and the pin it's pulling on is grounded, the pin becomes a direct path to ground (a short for the power-supply). The resistor prevents it from being a direct short. Same thing, applies for a pull-down resistor, although slightly less direct. And,
  2. The resistor is necessary to create 'potential'. One one side of the resistor is the power-source (either ground or positive). On the other side is the pin and whatever current potential is on it. If the two are different, they will try to equalize by flowing through the resistor towards the power-supply (effectively pulling the signal in that direction).

Hope that helps.

August 02, 2009
by sgmaniac1255
sgmaniac1255's Avatar

thanks,

how do we know what Ohm resistor to use when pulling the voltage up or down. is there a formula of some kind, or is it just T&E with past experience coming to play?

August 02, 2009
by rajabalu21
rajabalu21's Avatar

Please have a look at this explanation. It looks like the value is not very important as long as it is within the range of 10K to 47K and we could limit the current flow without.

August 03, 2009
by sgmaniac1255
sgmaniac1255's Avatar

thanks, that clears it up for me

August 05, 2009
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Just to add another voice here with more considerations about selecting an appropriate resistance to use for a pull-up or pull-down resistor:

  1. When the pull-up resistor'ed input is pulled low by whatever is on that pin, the current will be equal to the supply voltage divided by the pull up resistance. So this means that we generally want as high a resistance as possible so we waste little current here.
  2. There can be unintentional, high-resistance current paths between pins, whether due to some "junk" on a circuit board, moisture on a package, and some parasitic leakage paths inside the IC itself. But these paths are are often on the order of 10-100 million ohms or more. So if we keep our pull-up resistance below say 1 million ohms, these leakage paths will have only a small effect.
  3. Every input pin has some capacitance to ground (or equivalently, to the high voltage supply). It takes time for this capacitance to charge or discharge. When a pull-up'd pin is pulled low by whatever is connected (i.e. a button), the charge can discharge very very quickly through the low resistance of the button. But when that button is opened, the capacitor must charge up again through the pull-up resistor. So for large values of pull-up resistors, the time constant T=R*C could end up being fairly long. For example, with an input capacitance of maybe 10pF (which is a max -- see ATmega168 datasheet page 309) and a pull-up resistor of 10Meg, the time constant is 0.1 milliseconds. This is not a big deal if you're trying to read a button keypress, but would be if you are trying to read some other kind of sensor like trying to see the 40kHz IR modulations from a remote control with a phototransistor, etc.

So you need to think about current, leakage, and switching time, and the appropriate compromise often ends up being in the range of 10K-1Meg. Hope that helps!

Mike

August 05, 2009
by wayward
wayward's Avatar

Point 3. excellent, please make this a sticky post, thanks. :)

Post a Reply

Please log in to post a reply.

Did you know that the microcontroller's crystal oscillator can be used to keep accurate time? Learn more...