Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

After learning and experimenting with microcontrollers, the concept of pull-up- and pull-down resistors has been understood and saved to my hard drive. I now understand when and how to use them, and how they work. I've mainly used pull-ups because I was taught to, but it has always seemed a little backwards to me, as closing the switch sets the MCU input to LOW. I think it would make more sense to use a pull-down resistor, so that the input is LOW when the switch is open, but that is just my way of thinking.

Your eyes have probably been hurt by my stupid statements, but in the name of a total newbie to circuit design I ask: Should I pull my single-throw inputs up or down? When is pulling down preferred over pulling up and vice versa?

share|improve this question
    
For the OPs question, I believe #3 is the most important (after any requirements of the part, such as I2C) -- the total allowable current for the microcontroller shouldn't be wasted on the wrong pull-up or pull-down resistor. –  Julie in Austin Jun 4 at 4:29

4 Answers 4

up vote 13 down vote accepted

The answer depends on what you want the "default" configuration to be. For example, say you have a down-stream N-channel MOSFET, and you want it default off. Then you would use a pull-down resistor to ensure this behavior if the input becomes high impedance.

schematic

simulate this circuit – Schematic created using CircuitLab

On the other hand, suppose you have an upstream P-channel MOSFET, and want it default off. This time a pull up resistor is required to create this behavior.

schematic

simulate this circuit

There's also the alternative case where you want a device to be default-on, in which case the above two cases would be reversed (pull-up for the N-channel MOSFET, pull-down for the P-channel MOSFET).

A few other considerations:

  1. I2C lines specify pull-up resistors because devices are "expected" to have an open-drain to ground, and thus need some way to raise the line potential.

  2. Analog comparators are usually configured as open-drain devices, and thus also need pull up resistors to get a high potential output.

  3. You may draw more current using pullup/pulldown resistors, depending on what's hooked to the input/output.

  4. Either configuration could works equally well in your application (i.e. there's no significant advantage one way or the other).

... And any number of very application-specific reasons why one configuration may be preferred.

share|improve this answer

If the signal doesn't already have a specification, use whichever one makes the most sense to you. It is your choice to make an input active-high or active-low.

If it's buttons, make sure to use a debounce circuit (or do it in software).

schematic

simulate this circuit – Schematic created using CircuitLab

share|improve this answer

If your circuit design is such that you can choose - in other words you aren't required by the rest of the circuit to use a pull up or pull down - then you should consider safety and security in the case of failure.

If your microcontroller fails, or just that output fails, the pull up or pull down will be in effect. How will this change the operation of your device? Will it put the user in danger - for instance by forcing a heating element on? Will it affect security, such as disabling a door lock?

Pull up/down resistors determine the default state of the wire. Deciding what the default state should be depends on safety, security, and finally the desired functionality of the circuit.

share|improve this answer

You often want pull-ups or downs - often downs - on outputs of programmable devices like microcontrollers to define their state during power up sequences. Such outputs are often high impedance on power on, and connected devices can get unintended signals if this is not done. If for example multiple supplies are involved it's best to design each section as safe with zero volts on the inputs and to use pull-downs.

Bit more obscure than the other answers, but I've seen examples involving blue smoke and threats of legal action.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.