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* tutoral, John. I’ve been tryng to wrap my head around pull-up and pull-down resstors for a whle and, lke all good tutorals, you made them so smple that I feel knd of stupd for not understandng them before (I’m used to that, though).

    Are pull-up and pull-down resstorsonly necessary only when workng wth CMOS ICs, or are they needed for TTL ones as well? A book I have says t’s a good habt to use them all the tme (.e. HIGH s always truly hgh and LOW s always truly low).

    Please keep up the great work,
    Phl

    • John Boxall says:

      Mate, never, ever thnk you are stupd. Learnng s a lfelong journey, and s never completed. Always use them for CMOS, a quck look at my books say TTL nputs when floatng are usually hgh, so a pullup resstor would normally be used for floatng nputs. I wll look nto t further tonght and update the post.
      Have fun, John

  2. Phil says:

    Sorry, one more queston: When you say that the IC nputs are hgh mpedance, how hgh of an mpedance are we talkng about?

    You menton that wth SW2 open, the voltage at nput B s stll at 5 volts, whch means that nearly zero volts are dropped across R2. If I understand how a voltage dvder works (where R2 s one resstor, and the IC s the other), ths would mean that the resstance offered by the IC s MUCH hgher than 10K ohms, correct?

    Thanks agan,
    Phl Hutchnson

  3. Angel says:

    Another excellent tutoral, John!
    Ths s the smplest explanaton of pull-up/down resstors I’ve seen :)

  4. H,

    Thanks for the fantastc tutorals. I am strugglng however to understand the second part of your reasonng – the pull up resstor. You wrte:
    “When SW2 s closed, nput B wll be set to zero volts, va the drect connecton to ground. ”
    Yes – but B s *also* connected to 5V – there must be current flowng n that drecton (5v thru R2 to B) and as such why s t 0V?
    I don’t understand why when SW1 s closed I would get 5V at A but when SW2 s closed I would get 0V at B? At that pont only the poston of the resstor s dfferent so the logc must come from that but I can’t wrap my hear around ths…

    • John Boxall says:

      When SW1 s closed, you get 5V at pont A as ths s a drect connecton to 5V and electrcty always chooses the path of least resstance. When SW2 s open, B s connected to the 5V va R2 and therefore ‘hgh’.
      When SW2 s closed the tny amount of current comng through the resstors goes straght to GND – and at the same tme the pont B s also connected to GND – so the voltage potental between the two ponts s 0V. cheers
      john

  5. Kyle says:

    Thanks John. However, there’s one thng I stll don’t understand. Why was a 10k ohm resstor used? Would a 10M ohm or 10 ohm resstor work less well n a pull-down/pull-up scenaro? Is there some formula for determnng the amount of resstance requred?

    • John Boxall says:

      I thnk t has just been one of those “well t’s been 10k forever” type of thngs. But serously, f the value was too low the voltage at the IC nput pn may be too low for the HIGH threshold and vce versa. If you play around wth Ohm’s law by lowerng the resstance you ncrease the amount of wasted current flowng through the resstor, etc.
      cheers
      john

Trackbacks/Pingbacks


Leave a Reply

Subscribe via email

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: