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.