A floating input gate. Not Good! |
Consider this schematic. The gate U1A has an input (pin 1) and an output (pin 2). The input state of most logic gates is called a high impedance. This means it provides no real power of its own. Therefore, if nothing is connected to pin 1, the value of the input is considered to be floating. Most gates will float towards a high state. This is a very weak condition, and any electrical noise could cause the input to go low. When switch S1 is closed (on), the input state at pin1 goes low. Since there is a definite connection to an electrical potential (in this case ground), the state of the pin is stable. When switch S1 is open (off), then input pin 1 is susceptible to a wide array of electrical problems. The traces or wires connected to pin 1 may very well allow enough electrical noise in (by acting as little antennas) to cause pin 1 to incorrectly switch states. What is needed here is a way to connect pin 1 to an electrical potential that can be removed when the switch is closed. This electrical potential will allow the pin to keep a steady state. |
One thought is to tie the pin to Vcc (+5 volts) to insure that pin 1 doesn't float. The circuit to the right certainly does that. With pin 1 tied directly to Vcc, the line does not float, and has an ON state. The problem with this circuit is what happens when switch S1 is closed. This creates a direct electrical connection between Vcc and GND. In other words, it will short out the circuit. If you are lucky, it will just stop your entire system from working. If you are unlucky, it will burn up the wires! The problem with short circuits is they allow too much current to flow from Vcc to GND. This causes heat to be generated, which can sometimes burn parts, wires, or even start fires. In addition, most circuits fail to function correctly because the voltage at the power supply drops to zero. In general, this is a bad situation! | A very bad idea! |
Pull-up resistor limits the current | Now consider the next schematic, which is similar to the first but has added a pull-up resistor. This resistors function is to limit the amount of current that can flow through the circuit. When switch S1 is open (off), pin 1 is tied to Vcc through the resistor. Since pin1 is a high impedance input, a voltage meter or logic probe placed on pin 1 will show Vcc (+5v) if connected to pin 1. When switch S1 is closed (on), pin 1 has a direct connection to GND, which takes it to the low state. The pin1 side of R1 also has a direct connection to ground. Current will flow from Vcc, through R1, and to ground. It isn't considered a short, however, because R1 will limit the amount of current that can flow to a very small amount. In fact, you can compute this using Ohms law. I = V / R I = 5v / 10,000ohms I = .0005A (.5mA) |
A variation on this them is a pull-down resistor. Just like the pull-up resistor, it is used to limit the current that can flow between Vcc and ground. Though less often used, it is still a valid thing to do. Most digital circuits use a 10k or a 47k resistor for pull-ups. The exact value doesn't actually matter, as long as it is high enough to prevent too much current from flowing. 10k seems to be the most common, but if you are hoping to save as much power as possible, the a 47k resistor may be right for your application. In some cases, you can go higher, but then you are depending on characteristics of the pins on the chip. | The less common pull-down
|
|
In Summary
You will find that pull-up resistors are extremely common is most digital circuits. The key function for a pull-up is to prevent input lines from floating. The key function for the resistor itself is to prevent too much current from flowing through the pull-up circuit.
Ref: The Encoder, the Newsletter of the Seattle Robotics Society.
Definitions : :
Resistor: A resistor is a portion of an electronic device that lowers the voltage between its two terminals. The voltage drop is intended to oppose, or "resist," an electrical current. The drop in voltage is inversely proportional to the amount of current that is being opposed.
Logic gate: A logic gate performs a logical operation on one or more logic inputs and produces a single logic output. The logic normally performed is Boolean logic and is most commonly found in digital circuits.
U1A 74HC04: This is a hex inverter. The pin diagram of 74HC04 is shown here.
Hex inverter: The Hex Inverter is integrated circuit that contains six (hexa-) inverters.