# Electronic components – the Resistor (Part Three)

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:

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 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.

# Electronic components – the Resistor (Part Two)

Today we continue with the series of articles on basic electronics with this continuation of the article about the resistor. Part one can be found hereWith regards to this article, it is only concerned with direct current (DC) circuits. In this chapter we will examine how two or more resistors alter the flow of current in various ways. First of all, let’s recap what we learned in the previous chapter.

Ohm’s Law – the relationship between voltage, current and resistance:

Resistors in series:

Resistors in parallel:

Dividing voltage with resistors:

However the fun doesn’t stop there. As there is a relationship between voltage, current and resistance, we can also divide current with resistors. For now we will see how this works with two resistors. Please consider the following:

There is a balance between the two resistors with regards to the amount of current each can handle. The sum of the current through both resistors is the total current flowing through the circuit (It). The greater the resistance the less current will flow, and vice versa. That is, they are inversely proportional. And if R1 = R2, I1 = I2. Therefore, I1/I2=R2/R1 – or you can re-arrange the formula to find the other variables.

Here is an example of doing just that:

Our problem here – there is 6 volts DC at half an amp running from left to right, and we want to use an indicator LED in line with the current. However the LED only needs 2 volts at 20mA. What value should the resistors be?

First of all, let’s look at R1. It needs to change 6V to 2V, and only allow 20 mA to pass. R=E/A or R= 4 volts /0.2 amps = 200 ohms.

So R1 is 200 ohms. I1 is .02 A. Now we know that the total current is equal to I1+I2, so I2 will be 0.48A. That leaves us with the known unknown R2 🙂  We can re-arrange the formula R2/R1=I1/I2 to get R2 = (R1 x I1)/I2 – which gives us R2 of 8.3 ohms. Naturally this is a hypothetical, but I hope you now understand the relationship between the current through the resistors, and their actual resistance.

What we have just demonstrated in the problem above is an example of Kirchhoff’s current law (KCL). Gustav Kirchhoff was another amazing German physicist who worked on the understandings of electrical circuits amongst other things. More on GK here. His current law states that the amount of current entering a junction in a circuit must be equal to the sum of the currents leaving that junction. And not-coincidentally, there is also Kirchhoff’s voltage law (KVL) – the amount of voltage supplied to a circuit must equal the sum of the voltage drops in the circuit. These two laws also confirm one of the basic rules of physics – energy can not be created nor destroyed, only changed into different forms.

Here is a final way of wrapping up both KCL and KVL in one example:

The current through R3 is equal to I1 + I2

Therefore, using Ohm’s law, V1 = R1I1 + (R3 x (I1+I2)) and V2 = R2I2 + (R3 x (I1+I2))

So with some basic algebra you can determine various unknowns. If algebra is your unknown, here is a page of links to free mathematics books, or have a poke around BetterWorldBooks.

There is also another way of finding the currents and voltages in a circuit with two or more sources of supply – the Superposition Theorem.

This involves removing all the sources of power (except for one) at a time, then using the rules of series and parallel resistors to calculate the current and voltage drops across the other components in the circuit. Then once you have all the values calculated with respect to each power source, you superimpose them (by adding them together algebraically) to find the voltages and currents when all the power sources are active. It sounds complex, but when you follow this example below, you will find it is quite simple. And a lot easier the th.. fourth time.  Just be methodical and take care with your notes and calculations. So let’s go!

Consider this circuit:

With the Superposition theorem we can determine the current flowing through the resistors, the voltage drops across them, and the direction in which the current flows. With our example circuit, the first thing to do is replace the 7V power source with a link:

Next, we can determine the current values. We can use Ohm’s law for this. What we have is one power source, and R1 which is in series with R2/R3 (two parallel resistors). The total current in the circuit runs through R1, so calculate this first. It may help to think of the resistors in this way:

Then the formula for Rt is simple (above), and Rt is And now that we have a value for Rt, and the voltage (28V) the current is simple:

Which gives us a value of 6 amps for It. This current flows through R1, so the current for R1 is also 6 amps. Next, the current through R2:

Using Kirchhoff’s Current Law, the current flowing through R2 and R3 will equal It. So, this is 4 amps.

At this point, note down what we know so far:

For source voltage 28V, Ir1 = 6A, Ir2 = 2A and Ir3 = 4A; R1=4 ohms, R2 = 2 ohms, R3 = 1 ohm.

Now – repeat the process by removing the 28V source and returning the 7V source, that is:

The total resistance Rt:

Gives us Rt = 2.3333 ohms (or 2 1/3);

Total current It will be 7 volts/Rt = 3 amps, so Ir3 = 3;

So Ir2 = 2A – therefore using KCL Ir1 = 3-2 = 1A.

So, with 7V source: Ir1 = 1A, Ir2 = 2A and Ir3 = 3A.

Next, we calculate the voltage drop across each resistor, again by using only one voltage source at a time. Using Ohm’s law, voltage = current x resistance.

For 28V:

Vr1 = 4 x 6 = 24V; Vr2 = 2 x 2 = 4V; Vr3 = 4 x 1 = 4V. Recall that R2 and R3 are in parallel, so the total voltage drop (24 + 4V) = 28 V which is the supply voltage.

Now, for 7V:

Vr1 = 4V, Vr2 = 4V, Vr3 = 3V.

Phew – almost there. Now time to superimpose all the data onto the schematic to map out the current flow and voltage drops when both power sources are in use:

Finally, we combine the voltage values together, and the current values together. If the arrow is on the left, it is positive; on the right – negative. So:

Current – Ir1 = 6 – 1 = 5A; Ir2 = 2 +2 = 4A; Ir3 = 4-3 = 1A;
Voltage – Vr1 = 24 – 4 = 20V; Vr2 = 4 + 4 = 8V; Vr3 = 4 – 3 = 1V.

And with a deep breath we can proudly show the results of the investigation:

So that is how you use the Superposition theorem. However, there are some things you must take note of:

• the theorem only works for circuits that can be reduced to series and parallel combinations for each of the power sources
• only works when the equations are linear (i.e. straight line results, no powers, complex numbers, etc)
• will not work when resistance changes with temperature, current and so on
• all components must behave the same way regardless to polarity
• you cannot calculate power (watts) with this theorem, as it is non-linear.

Well that is enough for today. I hope you understood and can apply what we have discussed today. The final chapter on resistors can be found here. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

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.

# Electronic components – the Resistor

Today we continue with the series of articles on basic electronics with this introductory article about the resistorWith regards to this article, it is only concerned with direct current (DC) circuits.

What is a resistor? It is a component that can resist or limit the flow of current. Apart from resistors, other electronic components also exhibit an amount of resistance, however the precise amount can vary. The unit of measure of resistance is the Ohm (Ω), and named after the clever German physicist Georg Simon Ohm. He discovered that there was a relationship between voltage (the amount force that would drive a current between two points), current (the rate of flow of an electric charge) and resistance (the measure of opposition to a current) – what we know as Ohm’s law – which states that the current between two points in a conductor is directly proportional to the potential difference (voltage) between the two points, and inversely proportional to the resistance between them.

Or, current = voltage / resistance. You should remember that formula, it can be useful now and again.

But I digress.

There are many types of resistors, each with a different application – but all with the same purpose. Let’s have a look at some now…

These are the most common type that you will come across. The larger they are, the great amount of watts (the amount of power dissipated by the resistance) they can handle. More common varieties can vary from 0.125 watt to 5 watts. For example, here is a 0.125W resistor, the  length of the body is 3.25 mm.:

The body colour of these smaller resistors usually indicates the type of resistor. For example, those with a beige body are carbon resistors. They are usually the cheapest, and have a tolerance of 5%. This means that the indicated value can vary 5% either way – so if your resistor read 100 ohms, the actual value could be between 95 and 105 ohms. Resistors with a blue-ish body are metal-film resistors. They are usually a little bit more expensive, but have a 1% tolerance. Unless you are really trying to save a few cents, use metal-films. Another example is this one watt resistor:

They are much larger, this example is 25mm long and 8mm in thickness. The size of a resistor is generally proportional to its power handling ability.

Do you see the coloured bands around the resistor? They are colour codes, a way of indicating the resistance and tolerance values. And for colour-challenged electronics enthusiasts, a royal PITA. Resistor values can vary, from zero ohms (technically not a resistor… but they do exist for a good reason) up to thousands of millions (giga-) of ohms.

Let’s learn how to read the resistor colour codes. First of all, have a look at this chart:

Some resistors will have four bands, some will have five. From personal experience, new resistors are generally five band now. So you just match up the first three bands from left to right, then the fourth band is your multiplier, and the last band is the tolerance. For example, the three resistors below are labelled as 560 ohm resistors:

So the bands are: green, blue, black, black, tolerance – 5, 6, 0 = 560, then 1 for multipler = 560 ohms. The carbon-film resistor (top) has a gold tolerance band – 5%, the others being metal film are brown for 1%. This is why it is much easier to have a nice auto-ranging multimeter. Now if you need a resistor that can handle more than one watt, you move into ceramic territory. Thankfully these are large enough to have their values printed on them. For example:

There are literally scores of varieties of resistors in this physical category. If you don’t have the time or penchant to visit an electronics store, browse around online catalogues with images such as Digikey, element14/Newark (USA), Mouser, etc.

Surface-mount resistors

These are the becoming the norm as technology marches on. Even electronics hobbyists are starting to work with them. They consist of two metal ends which make contact with the circuit board, and a middle section which determines the resistance. They are tiny! The smallest being 0.6 x 0.3 mm in size. The smaller sizes may not have markings, so you need to carefully keep track of them.

As an aside, here is a interesting article on how to solder SMD parts at home. Moving on…

Resistor Arrays

You may find yourself in the situation where you need multiple values of the same resistor in a row, for example to limit current to a bank of LEDs or an LED display module. This is where a resistor array can be convenient. You can usually find arrays with between four and sixteen resistors in a variety of casings which speeds up prototyping greatly – however they do cost more than the individual resistors. For example: (hover over image for description)

Variable resistors

As expected there are many types of variable resistors, from the tiny to the large. Just like fixed-value resistors you need to ensure the power-handling (watts value) is sufficient for your project.

Variable resistors normally consist of a surface track that has resistive properties, and a tiny arm or contact that moves along the track. There are three terminals, one at each end of the track, and one to the arm or wiper. You would normally use the wiper contact and one of the others, depending on which way you want the variable resistor to operate (either increasing or decreasing in resistance). For example:

So as the wiper moves clockwise, the resistance increases…

Starting with the small – a variety of trimpots, used more for refining settings and not general everyday user input. Here is a small range of PCB-mount trimpots:

The two on the left are not sealed, exposed to dust and other impurities that can interfere with them. The two on the right are enclosed, and have a smoother feel when adjusting, and are generally preferable. These trimpots are single-turn, which can make getting finite adjustments in high-value resistances rather difficult. However you can purchase multi-turn trimpots allowing you greater detail in adjustment. Trimpots are usually labelled very well, depending on the manufacturer. For example, the black one above is 10k ohm, easy. Some will have a numerically coded version. Such as the one on the right. It is labelled 501, which means 50 ohms with 1 zero after it, so it is 500 ohms. Another example is 254, that is 25 with four zeros, i.e. 250000 ohms or 25 kilo ohm.

Next up are potentiometers – the garden variety variable resistor:

Apart form the resistance and wattage value, there are two major types to choose from: linear and logarithmic. The resistance of linear ‘pots’ is equally proportional to the angle of adjustment. That is, if you turn it half-way, its value is (around) 50% of the total resistance. Ideal for adjusting voltage, brightness, etc. Logarithmic are usually for volume controls. Here is a very crude example of the logarithmic VR’s resistance value relative to wiper position:

When identifying your variable resistor, units marked with ‘A’ next to the value are logarithmic, and ‘B’ are linear. For example, B10k is a 10 kilo ohm linear potentiometer. These types are also available as doubles, so you can adjust two resistances at the same time – ideal for stereo volume controls. If you are going to build a project with these and mount them into a case, be sure to check that the knobs you want to use match the shaft diameter of the potentiometer before you finalise your design.

Light-dependent resistors

These can be a lot of fun. In total darkness their resistance value is quite high, around 1 mega ohm, but in normal light drops to around 17 kilo ohm (check your data sheet). They are quite small, the head being around 8mm in diameter.

Great for determing day or night time, logging sunrise and sunset durations, or making something that buzzes only in the dark like a cricket.

Digital potentiometers

Imagine a tiny integrated circuit that contained hundreds of resistors in series, and could have the resistance selected by serial digital control. These are usually classified by the total resistance, the number of potentiometers in the chip, the number of divisions of the total resistance offered, and the volatility of the wiper. That is, when the power is turned off, does it remember where the wiper was upon reboot, or reset to a default position. For example, Maxim IC have a range of these here.

Thermistors

Think of a thermistor as a resistor that changes its resistance relative to the ambient temperature. Here is a thermistor as found in the Electronic Bricks:

And the circuit symbol:

There are positive and negative thermistors, which increase or decrease their resistance relative to the temperature. Within the scope of this website, thermistors are not an idea solution to measure temperature with our microcontrollers, it is easier to use something like an Analog Devices TMP36. However, in general analogue situations thermistors are used widely.

Mathematics of resistors

Working with resistors is easy, however some planning is required. One of the most popular uses is to reduce current to protect another component. For example, an LED. Say you have an LED that has a forward voltage of 2 volts, draws 20 mA of current, and you have a 5V supply. What resistor value will you use?

First of all, note down what we know: Vs (supply voltage) = 5V, Vl (LED voltage) = 2V, Il (LED current = 0.02A). Using Ohm’s law (voltage = current x resistance) we can rearrange it so:

resistance = voltage / current

So, resistance = (5-2)/0.02 = 150 ohms.

So in the circuit above, R1 would be 150 ohms

Resistors in series

If you have resistors in series, the total resistance is just the sum of the individual values. So R = R1 + R2 + R3 …Rx

Resistors in parallel

Using resistors in parallel is a little trickier. You might do this to share the power across several resistors, or to make a value that you can’t have with a single resistor.

Voltage division with resistors

If you cannot reduce your voltage with a zener diode, another method is voltage division with resistors. Simple, yet effective:

Always check that the resistors you are using are of a suitable power handling type. Remember that W = V x A (power in watts = volts x current in amps)!

Update – “The resistor – part two” has now been published, with more information on how resistors divide and control current, and much more. Please visit here.

Well that wraps up my introduction to resistors. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

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.