Pull up vs. pull down resistors - Page 1
Forum section: electronics / beginners

author: Ch33f
author_rank: Newbie
timestamp: January 20, 2016, 12:41:17 pm
content: Hello everyone,I'm fairly new to the field of electronics and I have inevitably come across the idea of pull up/down resistors. I now wonder if it's better to use pull up or to use pull down resistors? What would be the reasons for one or the other?What I know:They are used in order to prevent floating in/outputs. If an in/output is floating (i.e. the cable is dangling in the air/not connected) it is relatively unpredictable/unreliable as to what it might read (HIGH/LOW). So in order to prevent that we connect the floating state (button not pressed) through a pull up resistor with our positive supply line and e.g. a button will short out the input pin to ground when pressed. Alternatively we connect the input through a pull down resistor to ground and the button will short it to our supply line.What I would like to know:As I am a experienced programmer, who recently started discovering the field of electronics as a hobby. To me a button that is not pressed should read LOW and a button that is pressed should read HIGH. That just makes sense in my head, but of course it would work either way (pull up or pull down). So up until now I usually went for a pull down resistor. But when I looked at circuits online it seems to me, that pull up resistors are more commonly used, than pull down ones.So my question is: Is there any benefit of one over the other? And what are the considerations coming into play here?My thoughts:At first I thought the pull down is better because you won't have any current flowing in the more common state (i.e. button not pressed). But thinking of Daves video on OpAmps I guess that is not quite valid, depending on the input of the IC or whatever you're using, since (almost) no current flows in or out of any input of an OpAmp. Assuming the same applies to comparators.I also can't actually think of any advantage of pull up resistors.I hope I can find enlightenment here.Thanks in advance!

author: TinkerFan
author_rank: Regular Contributor
timestamp: January 20, 2016, 01:01:38 pm
content: As far as I know (I would say I'm a beginner, but not a newbie...), you would use a pull up resistor if you want the button to be active low and a pull down if you want the button to be active high. The other side of the button (or whatever else you want) must therefore be grounded for pull up and vice versa. For a button you would normally use a pull down resistor (although I do not think it matters).A pull up is for example used in bus lines, that are to be active high.But I'm not 100% sure.

author: klunkerbus
author_rank: Unknown
timestamp: January 20, 2016, 01:10:53 pm
content: One reason you see a lot more pullups than pulldowns in designs is historical legacy. Back in the days of TTL design, it took a lot more current to pull down an input than it did to pull it up. Pull downs were tricky to use.

author: Ch33f
author_rank: Newbie
timestamp: January 20, 2016, 01:26:18 pm
content: Quote from: klunkerbus on January 20, 2016, 01:10:53 pmSo, that basically means that with oldschool TTL chips you should go with pull up? What about CMOS chips, does it matter on those?

author: Codemonkey
author_rank: Regular Contributor
timestamp: January 20, 2016, 01:31:54 pm
content: Bear in mind that a lot of micros may have weak on chip pullup resistors (you can usually turn these on or off). If you don't turn them off and add a pull down when nothing is happening, current will be flowing through the internal pullup and the external pull down increasing current consumption. Not ideal if your device is battery powered.

author: tggzzz
author_rank: Super Contributor
timestamp: January 20, 2016, 01:32:28 pm
content: You have thought about the subject and ask sensible questions; good.Consider inputs first.The value of the resistor should be high enough that the current drain through it is not a problem.The value of the resistor should be low enough that it holds the logic input in the desired state; this is calculated by finding the input DC current and using V=IR for the voltage drop across the resistor, and ensuring that the input voltage is in the valid logic range and nowhere near the threshold. For modern CMOS inputs the DC input current is trivial and symmetric, so either pull up or pull down resistors can be used and the value is not critical. For some older logic families such as the TTL variants, the input current is both significant and asymmetric; the asymmetry leads to a preference for a pull up resistor, and its upper value is restricted.The lower the pullup resistor, the less the input will be susceptible to AC noise coupled to the input, and the less it will be susceptible to ESD.There is likely to be more noise on a power supply rail than on a ground plane, and a pull up resistor can in theory couple some of that noise into the input.Whether a signal is active high or active low is of little consequence - either can be "removed" in software or other logic; de Morgan's theorem is your friend. Frequently a naming convention is used to indicate which is which, which copes with the concept that an active high open signal (open_h or open or open_p) can also be thought of as an active low closed signal (closed_l or closed_n)Consider outputs.Here pull up/down is determined by the output structure of the logic gate. Classically open-collector/drain gates have pullups, and open-source/emitter have pull downs. Consult your logic datasheet.Historically with TTL with asymmetric inputs and outputs it was often preferable to have active-low signals, but this is no longer relevant with CMOS devices.

author: klunkerbus
author_rank: Unknown
timestamp: January 20, 2016, 01:42:09 pm
content: Quote from: Ch33f on January 20, 2016, 01:26:18 pmWith CMOS, you're usually dealing with just a leakage current on the input so they're more receptive to the idea of a pull-down, yes.It also used to be that inputs had less noise immunity at low logic levels than high logic levels, and shorting an input to ground had an advantage. Again, I don't think that applies to CMOS.It never hurts to check datasheets for any surprises with input voltage thresholds or input currents.

author: Ch33f
author_rank: Newbie
timestamp: January 20, 2016, 02:14:05 pm
content: Thank you all for your really quick and competent help!It basically all clicked into place in my head now and I even understand the datasheet of my atmega1284p a lot better now! And I found information about the internal structure and how to turn on/off it's internal pullupresistor. Only thing I didn't find was the input current of the atmega1284p but as it's a CMOS chip I guess it's rather low. If anyone was searching for that information in that particular datasheet: It's on pages 70 and onwardshttp://www.atmel.com/images/doc8059.pdf.So, as a conclusion:TTL inputs: Prefferably active-low with pull up resistors. Consult input current on datasheet to determine maximum value for resistor.CMOS inputs: Because of symetric input current it's up to the user, if pull up or down is preffered. Input current is not that big of a deal compared to TTL but I guess a look at the datasheet doesn't hurt.Outputs: Depends on the internal structure of the chips outputs (open-drain with pullup or open-source with pulldown).Additionally: Keep in mind that chips may have internal pull up/down resistors which should be taken into consideration or turned off if possible, so they won't clash with external ones.Amazing! Thanks to all of you!

author: Tomorokoshi
author_rank: Super Contributor
timestamp: January 20, 2016, 06:14:20 pm
content: I will use either a pull-up or a pull-down for unused inputs depending on what I need them to do.When it comes to switches or buttons, I've usually used only pull-ups. This is because we need to read the voltage at the switch. When the switch is open, the input is pulled up by the resistor. The switch then shorts it to ground, allowing you to read the value. Current flows through the resistor only when the switch is closed.Now consider the case where a pull down was used instead. The open switch would have a relatively low-impedance power supply on it. When the switch is closed, this low-impedance source is now connected to the input, which if there isn't a series resistor could be a problem. Any series resistor would need to be significantly lower than the pull-down in order to guarantee a good logic level.If you account for faults in the system, a pull-up is safer because energy is limited at that point. Handling the logic inversion is easily done in the access function used to read the port.

author: KL27x
author_rank: Super Contributor
timestamp: January 21, 2016, 02:52:22 am
content: Where it would otherwise be completely arbitrary, you maybe should consider your board layout.If you use a pullup, you would use ground to switch the input. If you use a pulldown, you would use the power rail to switch the input. For a board that has a ground plane, already, it is usually more convenient to use pullups to make the trace layout easier and to keep direct, low impedance power rail more limited (in order to make the board inherently more resistant to direct power shorts, and more or less what ^ he said, but I see no problem using direct Vdd to switch the pulldown.... the resistor is already on the ground side). The direct path to ground is already accessible all over, whether you're using a transistor or a switch or a different IC or w/e, it can catch ground anywhere.For a board that has multiple positive voltage rails, it may be easer to use pullups. The same ground plane will completely switch all the pullups on any of the power rails. And in fact, pullups are often used in conjunction with open drain outputs in order to interface devices that are powered from different voltages.I often see pulldowns used on boards that run off a watch battery, where the case and/or major power plane on the board is the positive.

author: retrolefty
author_rank: Super Contributor
timestamp: January 21, 2016, 03:05:34 am
content: I try and always add a series resistor between a button switch and it's I/O pin of 200 ohms in case I ever have a brain fart and change the pin to an output pin by mistake and forget there is a hardwired button wired to ground or Vcc when pushed.

author: KL27x
author_rank: Super Contributor
timestamp: January 21, 2016, 05:04:14 am
content: QuoteIt depends on the application, of course. For a dev board or something, sure. But for a finished board, this could just be adding parts and cost and creating more change for fabrication errors.I know it would make lots of you guys vomit, but I will even omit a pullup/down on a FET gate to save parts, relying on the uC to do it. I know... there's a startup delay and all.. possible brownouts. The partially switched FET must be derated for the peak surge it might get at startup, etc. I will try to take everything into consideration, of course.I'll also omit the current limiting series resistor with a small logic level FET.