# Resistor values calculation: how to arrive at these values? (Make: Electronics example 10)

I'm finally trying to learn basic electronics and working through Make: Electronics. Excellent book so far, but I often wonder how exactly the author calculated the necessary resistor values and I feel that I absolutely have to understand this before diving into more complex topics. Let's look at example 10:

+12VDC o--+-----R1--Q--R3--D--o 0VDC
|         |
+--S--R2--+

• R1 = 180Ω
• R2 = 10kΩ
• R3 = 680Ω
• Q = NPN transistor 2N2222
• S = switch
• D = LED

(R1 is connected to collector of transistor, R2 to base, R3 to emitter)

In an earlier part of the book, the author assumed that the LED requires 2.5V/20mA. I assume that as soon as S is pressed and the transistor is conducting, the current can flow through collector/emitter to the LED and all that matters for the LED part are R1+R3.

So since we've got 12V and only need 2.5V/20mA for the LED, I've calculated R = 9.5V/0.02A = 475Ω, but R1 + R3 = 860Ω. I've tried to insert different values and struggled with this for an hour but I don't get why specifically 180Ω and 680Ω were chosen.

Edit: Updated the drawing with respect to the power supply.

• The only change you need is -12v should be 0v at the end. Dec 30, 2012 at 11:59
• Draw a real schematic. I can't "see" the circuit from your ASCII art, I have to figure it out first. No thanks. Draw the schematic (neatly!) on a piece of paper and scan it if you have to. Dec 30, 2012 at 13:49
• Im also learning electronics, im an EE student and let me tell you that if you want to know the answer to questions like that you need to study more deeply the transistor operation, you need to start first reading about the diode to get a good idea of how a pn junction works, then go to the transistor, the book you are reading is great to get a general idea of how to do circuits, but those type of books leave a lot of info uncovered, I recommend you read Boylestad/Nashelsky "Electronic Devices and Circuit Theory" or Sedra/Smith "Microelectronic Circuits" to understand exactly how stuff works.
– S.s.
Dec 30, 2012 at 17:54

Chapter 2, Experiment 10 correct?

The reason it doesn't work as you expect, is that you are assuming that the led should be getting 20ma or so in this circuit. The experiment doesn't really care about current, it is designed to teach about the transistor as a switch.

The reason you have two resistors inlined with the led, R1 and R3, is really for the learner's benefit. R1 exists so that the learner can measure the voltage across it, to show that the voltage exists. The resistors are pretty much arbitrary choices that still provide enough to light the led. 9.5v / 860Ω = 11ma. Could just as easily have been 300Ω and 560Ω or 430Ω and 430Ω.

You can see a bit more about it in the Theory section on page 80/81.

• Thanks, so I don't need to worry that I missed something elementary up to this point. Dec 30, 2012 at 12:13

The computation has to be done as follow:

Referring to your diagram, the current that light up the LED follow this path: from +12V -> R1 -> Q -> R3 -> D to -12V. (you can neglect the current from the base of Q)

The total supply voltage is 24V (from -12V to 12V)

The value of the resistor is set to make sure that in worst case conditions, the current is kept below the 20mA max of the diode. This worst case condition is when the transistor is in saturation (when it has the highest conduction between the collector and the emitter). In this case these is a voltage of Vce_sat between the collector and the emitter. It could be as low as 400mV according to a datasheet found on the web.

Thus the voltage across R1, Q, R3, D in series should be 24V when there is a current of 20mA.

$$24V=R1*I+Vce_{sat} +R3*I + V_{diode}$$ $$24V=(R1 + R3 )*I+Vce_{sat} + V_{diode}$$ $$24V - Vce_{sat} - V_{diode}=(R1 + R3 )*I$$ $$\frac{24V - Vce_{sat} - V_{diode}}{I}=R1 + R3$$ $$\frac{24V - 0.4V - 2.5V}{20mA}=R1 + R3=1055\Omega$$

This means that to guaranty that the current will not exceed the 20mA, which is the LED limit. The sum of R1 and R3 should be greater than 1055 ohm.

• I think my drawing is wrong, the power supply should be set to 12V. If I insert 12V in your formula, I end up with 455Ω (thanks for the Vce__sat part, new information that was missing). Maybe the author arrived at similar values and then doubled the resistance/rounded to nearest standard values to be on the safe side? Dec 30, 2012 at 11:46
• The OP lists -12v, but they undoubtedly mean 0v, basic ground. Only 12v potential not 24v. Dec 30, 2012 at 11:47

Because the transistor is a non-linear device. You can't use Ohm's law to analyze it like that. I recommend you review this tutorial to better familiarize yourself with the behavior of bipolar junction transistors.

If you have any specific follow-up questions, comment on my answer, and I'll try to address them here.

• Thanks for the link, have already read the linked page 2 and think I've understood most of it, however it doesn't help me understanding how to calculate the necessary resistor values for such a simple circuit yet. Dec 30, 2012 at 11:41
• See @Blup1980's design walkthrough below. The problem here is that there is no closed form solution to the system of equations. You have to use Newton-Raphson (or some other iterative approach). Engineers hate doing math needlessly, so we use intuition to simplify the design process. We don't want the diode to explode, so we assert it's Q point. We want the NPN BJT in forward-active mode so we assert Vbe. Etc... Dec 30, 2012 at 11:53
• I see, so it sometimes (often ?) just ends up being more experience/estimation than precise values. So in these cases, it's more important for me to understand do I need a high or low resistance here than being able to calculate the exact values? Dec 30, 2012 at 12:03
• No I don't think estimation is a good thing to do. Usually, you should compute the min and max values allowed for a particular component. According to the worst case of temperature, input voltage, gain tolerance of the transistor,..., the resistor should be greater than let say 11.8k (for instance) and smaller than 223k (for instance). You can choose whatever value in between, your design will work. Then you can choose if you want more light from the LED and select a value close to 11.8k or if you want to reduce the consumption and then select a value close to 223k. Dec 30, 2012 at 13:07
• And I agree with @DrFriedParts, if you want the exact solution of the system, it's not easy. For instance: the current in the diode defines its voltage. But you need to know the voltage across to compute the resistor that sets the current... For instance, the voltage across the diode is given from the datasheet at 2.5V@20mA but with the temperature and other factor, it could be less. If you compute with that value, you will get a resistor value (the min allowed value) that is NOT the real limit due to our assumption. Then you can select a resistor value that is not too close to that limit. Dec 30, 2012 at 13:22

Well I think you got your answer plus a little more. As you can see there are no hard values for the resistors as the led will operate on a range of different current values which will be shown in it's datasheet. The other thing is, it is now time for you to start reading datasheets as that is where the real information is to determine what values your parts can operate under. As Blup1980 pointed out and you grasped is that there is still a voltage drop across the collector emitter even when the transistor is fully on(saturated) this value varies with collector current and temperature and is shown in a graph in the datasheet. The datasheet is your friend!