Pull up and pull down resistors
When working with digital electronics circuits, you will most likely be working with CMOS integrated circuits, such as the 4541 programmable timer we reviewed in the past. These sorts of ICs may have one or more inputs, that can read a high state (like a switch being on) or a low state (or like a switch being off). In fact you would use a switch in some cases to control these inputs. Consider the following hypothetical situation with a hypothetical CMOS IC in part of a circuit from a hypothetical designer:
The IC in this example has two inputs, A and B. The IC sets D high if input A is high (5V), and low if A is low (0V). The designer has placed a button (SW1) to act as the control of input A. Also, the IC sets C high if input B is low (0V) or low if it is high (5V). So again, the designer has placed another button (SW2) to act as the control of input B, when SW2 is pressed, B will be low.
However when the designer breadboarded the circuit, the IC was behaving strangely. When they pressed a button, the correct outputs were set, but when they didn’t press the buttons, the IC didn’t behave at all. What was going on? After a cup of tea and a think, the designer realised – “Ah, for input A, high is 5V via the button, but what voltage does the IC receive when A is low? … and vice-versa for input B”. As the inputs were not connected to anything when the buttons were open, they were susceptible to all sorts of interference, with random results.
So our designer found the data sheet for the IC, and looked up the specification for low and high voltages:
“Aha … with a supply voltage of 5V, a low input cannot be greater than 1.5V, and a high input must be greater than 3.5V. I can fix that easily!”. Here was the designer’s fix:
On paper, it looked good. Input A would be perfectly low (0V) when the SW1 was not being pressed, and input B would be perfectly high (connected to 5V) when SW2 was not pressed. The designer was in a hurry, so they breadboarded the circuit and tested the resulting C and D outputs when SW1 and SW2 were pressed. Luckily, only for about 30 seconds, until their supervisor walked by and pointed out something very simple, yet very critical: when either button was pressed in, there would be a direct short from supply to ground! Crikey… that could have been a bother. The supervisor held their position for a reason, and made the following changes to our designer’s circuit:
Instead of shorting the inputs straight to supply or earth, they placed the resistors R1 and R2 into the circuit, both 10k ohm value. Why? Looking at SW1 and input A, when SW1 is open, input A is connected to ground via the 10k resistor R1. This will definitely set input A to zero volts when SW1 is open – perfect. However when SW1 is closed, input A is connected directly to 5V (great!) making it high. Some current will also flow through the resistor, which dissipates it as heat, and therefore not shorting out the circuit (even better). You can use Ohm’s law to calculate the current through the resistor:
I (current) = 5 (volts) / 10000 (ohms) = 0.0005 A, or half a milliamp.
As power dissipated (watts) = voltage x current, power equals 0.0025 watts, easily handled by a common 1/4 watt resistor. Our resistor R1 is called a pull-down resistor as it pulls the voltage at input A down to zero volts.
And with R2, when SW2 is open, input B is connected directly to 5V via R2. However. as the IC inputs are high impedance, the voltage at input B will still be 5V (perfect). When SW2 is closed, input B will be set to zero volts, via the direct connection to ground. Again, some current will flow through the resistor R2, in the same way as R1. However, in this situation, we call R2 a pull-up resistor, as it pulls the voltage at input B up to 5V.
Generally 10k ohm resistors are the norm with CMOS digital circuits like the ones above, so you should always have a good stock of them. If you are using TTL ICs, inputs should still not be left floating, use a pull-up resistor of 10k ohm as well. Pull-up resistors can also be used in other situations, such as maintaining voltages on data bus lines, such as the I2C bus (as used in our Arduino clock tutorials).
In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other – and we can all learn something.
Latest posts by John Boxall (see all)
- Tutorial – PCF8574 backpacks for LCD modules and Arduino - September 24, 2014
- Arduino Workshop – A Hands-On Introduction with 65 Projects - May 6, 2014
- Project Review – Silicon Chip Capacitance Substitution Box - April 23, 2014