# How the pull-up resistor settles the logic level?

According to Wikipedia, "Pull-up resistors are used in electronic logic circuits to ensure that inputs to logic systems settle at expected logic levels if external devices are disconnected or high-impedance is introduced."

and in the above figure, When the switch is open the voltage of the gate input is pulled up to the level of Vin. When the switch is closed, the input voltage at the gate goes to ground.

What is the point of using the pull-up resistor anyway in this circuit ?

For example, If i were to remove the pull-up resistor from the circuit above, and the switch is open, still the voltage of the gate is pulled up the level of Vin. Why use the Pull-up resistor then ?

• "If i were to remove the pull-up resistor from the circuit above, and the switch is open, still the voltage of the gate is pulled up the level of Vin." Why do you expect that to happen? Dec 24, 2013 at 10:15
• I think he means hard-wiring the gate input to Vin without realizing the short that will be created when the switch to ground is closed. Dec 24, 2013 at 10:39
• @alexan_e this is exactly what i meant Dec 24, 2013 at 10:45

For example, If i were to remove the pull-up resistor from the circuit above, and the switch is open, still the voltage of the gate is pulled up the level of Vin.

There are two ways of interpreting this sentence, both of which lead to problems in the circuit.

If we replace the resistor with an open, the input will be floating when the switch is open. You do not want floating inputs on CMOS inputs as that can lead to increased power consumption and possibly damage the input stage.

If we replace the resistor with a short, the input will indeed be pulled high when the switch is open. But if the switch is closed then you will short out your supply which is a Very, Very Bad Thing.

In both cases the solution is to have a resistor to the positive supply and a switch to ground, or vice versa depending on what you want the default input logic level to be.

• how come its a bad thing to short out the supply ? , also if the resistor is connected and switch is closed, the supply is still shorted, isn't it ? Dec 24, 2013 at 10:47
• Because your circuit is then supplied 0 volts. No, because there's a resistor in the way. Dec 24, 2013 at 10:48
• In addition, should anything happen to the attached circuit causing a short within that, the resistor protects the power supply from that, too.
– Rob
Dec 24, 2013 at 15:59
• Short is quite obvious. But what's wrong with floating input? Taking into account that pull-up is usually high impedance, does it mean that input still floats, doesn't it? Jan 7, 2016 at 20:11
• @user3050403: "Floating" has a specific meaning. As long as the input is tied to a voltage with a material of relatively high conductivity, it will not be floating. Jan 7, 2016 at 20:41

To rephrase - a short is really a very low resistance, so low that your power supply can not source enough current to develop a steady voltage and as a consequence the output of your power supply drops to almost 0V, doing some nasty stuff on the way - resetting/turning off everything on board (nothing can work on 0V) AND letting all the current that it can source to run thru the switch. Probably causing something to heat up and evaporate.

When there is a reasonably big resistance pull up resistor, you don't have this problem - the power supply can easily source enough current to develop a rated voltage across it. In this case you'll get 0V at the bottom of pullup resistor when the switch is closed, but power supply will still provide proper regulation and no high current will flow thru the switch. (well almost 0V, the switch has some small resistance that was causing problems in previous paragraph, but it's so small when compared to pullup resistance, that it's negligable in this case)

You don't leave the input floating as it's effectively a gate of a FET that is really just a small capacitor that can easily charge up or discharge from stray electric fields that are always present around, turning the input on or off. I.e. you would not be able to determine when the switch is really off.

I'm sure you can find far better explanations on pullups in this site written by true greybeards, just look around.