Tuesday, November 20, 2012

Using pull up / pull down resistors

Pull up and pull down resistors are used to eliminate floating inputs. Normally a input is either connected to a high (on), or a low (off). But if the input is not connected to anything, it's "floating" and can read either, or cycle back and forth due to stray currents, so it's not a reliable state. A resistor is used to pull an input to the opposite of what you are trying to read (ground if you are trying to read a high, +5V if you are trying to read a low). This resistor prevents a short circuit (you can't connect +5v to gnd), and makes sure the input is in a stable state when not connected, but is ignored when your input is connected to a high or a low.