Electronic components – the Resistor (Part Three)

Hello readers

Today we conclude the series of articles on the resistor. You may also enjoy part one and twoWith regards to this article, it is only concerned with direct current (DC) circuits.

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:

cir1

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:

lowhigh1

“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:

cir2

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:

cir3

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 twitterGoogle+, 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.

 

The following two tabs change content below.

John Boxall

Founder, owner and managing editor of tronixstuff.com.

12 Responses to “Electronic components – the Resistor (Part Three)”

  1. Phil says:

    *Excellent* tutorial, John. I’ve been trying to wrap my head around pull-up and pull-down resistors for a while and, like all good tutorials, you made them so simple that I feel kind of stupid for not understanding them before (I’m used to that, though).

    Are pull-up and pull-down resistorsonly necessary only when working with CMOS ICs, or are they needed for TTL ones as well? A book I have says it’s a good habit to use them all the time (i.e. HIGH is always truly high and LOW is always truly low).

    Please keep up the great work,
    Phil

    • John Boxall says:

      Mate, never, ever think you are stupid. Learning is a lifelong journey, and is never completed. Always use them for CMOS, a quick look at my books say TTL inputs when floating are usually high, so a pullup resistor would normally be used for floating inputs. I will look into it further tonight and update the post.
      Have fun, John

  2. Phil says:

    Sorry, one more question: When you say that the IC inputs are high impedance, how high of an impedance are we talking about?

    You mention that with SW2 open, the voltage at input B is still at 5 volts, which means that nearly zero volts are dropped across R2. If I understand how a voltage divider works (where R2 is one resistor, and the IC is the other), this would mean that the resistance offered by the IC is MUCH higher than 10K ohms, correct?

    Thanks again,
    Phil Hutchinson

  3. Angel says:

    Another excellent tutorial, John!
    This is the simplest explanation of pull-up/down resistors I’ve seen :)

  4. Hi,

    Thanks for the fantastic tutorials. I am struggling however to understand the second part of your reasoning – the pull up resistor. You wirte:
    “When SW2 is closed, input B will be set to zero volts, via the direct connection to ground. ”
    Yes – but B is *also* connected to 5V – there must be current flowing in that direction (5v thru R2 to B) and as such why is it 0V?
    I don’t understand why when SW1 is closed I would get 5V at A but when SW2 is closed I would get 0V at B? At that point only the position of the resistor is different so the logic must come from that but I can’t wrap my hear around this…

    • John Boxall says:

      When SW1 is closed, you get 5V at point A as this is a direct connection to 5V and electricity always chooses the path of least resistance. When SW2 is open, B is connected to the 5V via R2 and therefore ‘high’.
      When SW2 is closed the tiny amount of current coming through the resistors goes straight to GND – and at the same time the point B is also connected to GND – so the voltage potential between the two points is 0V. cheers
      john

  5. Kyle says:

    Thanks John. However, there’s one thing I still don’t understand. Why was a 10k ohm resistor used? Would a 10M ohm or 10 ohm resistor work less well in a pull-down/pull-up scenario? Is there some formula for determining the amount of resistance required?

    • John Boxall says:

      I think it has just been one of those “well it’s been 10k forever” type of things. But seriously, if the value was too low the voltage at the IC input pin may be too low for the HIGH threshold and vice versa. If you play around with Ohm’s law by lowering the resistance you increase the amount of wasted current flowing through the resistor, etc.
      cheers
      john

Trackbacks/Pingbacks


Leave a Reply

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: