# Which side should I put the resistor?

I'm a beginner and trying to understand some basics of electricity.

One thing I'm having a hard time understanding is the correct side where I should put a resistor. For example, in the following circuit:

The author of the schematic is putting 7 470ohm resistors in the 7-segment display. Why? Can't he put one single resistor in the cathode side of the display? I also saw some schematics where a resistor is put in both sides of the display. Is it necessary?

There are also resistors in the connectiong the inputs ABCD of the 4511 with the ground. Couldn't these 4 resistors be replaced by one single resistor in the left side of the switches? Or perhaps between the 4511 and the ground (or the positive voltage source)?

-
 The 10K resistors are pull down and without them the input will float and be undefined rather than 1/0 or high/low. The 470ohm resistors are required if you san the brightness the same whether or not more than 1 segment is one at a time. – kenny Aug 4 '12 at 23:18

First the switches' resistors. Moving one of them to the left side of the switches is pointless: it would just be between +6 V and ground and draw a constant low current. The switches will only see the 6 V, and not even know the resistor is there.

The 4511 is a CMOS IC, and these have the property of having a very high input impedance. So high that the voltage on it may vary all by itself if you leave it unconnected, what we call floating. At best it may change the number on your display, worst case the input may get damaged. When you close a switch this will make that input high, and then there's no problem.

But when the switch is open you want that input to go low. You can't simply connect the pin directly to ground, because closing the switch would short-circuit the power supply. So you use a resistor to bring the input to a defined, low value. When there's current flowing through a resistor it will cause a voltage drop due to Ohm's Law, but with the high-impedance input there's nowhere any current can come from, and then the voltage across the resistor will be zero, so that the input will be at 0 V level.

Here they use 10 kΩ resistors, which is OK. A lower resistance value will give you a more solid connection to ground, but also cause more current when you close the switch. Closing a switch will bring that input to +6 V, and then there will flow a current through the resistors: 6 V/ 10 kΩ = 0.6 mA. That's rather low, but in very low power circuits they may use higher resistance value; 100 kΩ is still OK, and will further reduce the current when switches are closed.

Then the display's resistors. If the LEDs would be all exactly the same you could indeed replace the 7 resistors by one on the cathode side. But this world is not perfect and ther may be small differences in LED voltage. If one LED has 2 V and its neighbor 1.95 V the current will go for the latter. LEDs do have an internal resistance which will balance the currents a little bit, but the difference in current, and hence brightness will still be there.

And as Oli noted it gets worse. The voltage has a negative temperature coefficient, which means that it decreases as temperature increases. The current causes power dissipation in the LED, which increases its temperature. Then the LED with the highest current, which already had the lowest voltage, will see its voltage decrease even further, so that the current increases even more. This may lead to what's called thermal runaway, and only the series resistor and the small balancing effect of the LEDs' internal resistance are there to stop it.

That's one reason to have a resistor for each LED. Another reason is that you won't always have the same number of LEDs on. If the display shows a "1" there's just 2 LEDs on, with "8" that's 7. Suppose you use a single resistor, and you want 10 mA through your LEDs. If they have a voltage drop of 2 V your resistor should be (7 V - 2 V)/(7 $\times$ 10 mA) = 71 Ω. Display an "8" and the LEDs will get 10 mA each. But for a "1" that will be higher. The voltage drop across the resistor is still 5 V, so the current will still be 70 mA, but this time for only 2 LEDs, that's 35 mA per LED. Not only will brightness vary for each other digit, but the 35 mA may well be higher than what's maximum allowed.

Giving each LED its own resistor solves all that. The current will be eather zero, or 10 mA, no matter how many other LEDs are on, and no matter the small differences in LED voltage.

-

For the display, a resistor on each segment/LED is necessary to stop one LED hogging all the current. This is due to the fact that real LEDs are not ideal, and each LED has a slightly different forward voltage. Also, if less than all of them are on at a time, each LED will get a larger portion of the current available.

If we assume you put a single resistor in that was 1/8th of the original value (as the single resistor now has to carry the current for all 7 LEDs)
Now if all are on, and one LED has a slightly lower Vf (forward voltage) it will take slightly more of the current. This will cause it to heat up, which causes the Vf to drop, so it takes a bit more current, and so on.

In your example, lets see what happens with a single resistor:

Lets assume a 2V forward voltage for each LED (typical for a red LED)

At 6V supply, and 470 ohms on each resistor we get (6 - 2) / 470 = 8.5mA through each LED.

With the single supply, to make 8.5mA available for each LED, we need a resistor that will allow 8.5mA * 7 = 59.5mA.
So (6 - 2) / 59.5mA = 67.2 ohms (call it 67)
Lets forget about the current hogging, and assume we have ideal LEDs.

If we have all 7 LEDs on then as expected we get 59.5mA / 7 = 8.5mA each

For 4 LEDs on, we get 59.5mA / 4 = 14.9mA each (they will be brighter, but still okay as most LEDs are rated for 20mA or more)

For 2 LEDs on, we get 59.5mA / 2 = 29.7mA each which is above the rating of many standard LEDs.

For just a single LED we get the full 59.5mA, which will certainly damage it. So even without the current hogging there is a large problem.

For the current hogging, this is the case for constant voltage or constant current drive.
BridgeLux LED drive App note (page 12 relevant)

For the buttons, the resistors are there not to limit current, but to keep the pins voltage pulled to ground (0V) when the button is up. This is because CMOS inputs are very high impedance, so a "floating" input can be easily affected by external noise source so the input can wander between 1 and 0 randomly.