Basic Electronics, Chapter 5: Challenge 1 solution (LED resistors) Formulas: R = (Vs - Vf) / I round R UP to the next E12 value I(actual) = (Vs - Vf) / R(chosen) P(R) = I^2 R = (Vs - Vf)^2 / R P(LED) = Vf x I multiplexing: average current = peak current x duty cycle (a) Green LED (Vf = 2.1 V), 5 V supply, about 12 mA R = (5 - 2.1) / 0.012 = 2.9 / 0.012 = 241.7 ohm E12 values around it: 220, 270. Round UP: 270 ohm. (220 ohm would give 13.2 mA: allowed, but we decided to round up so the current never exceeds the target.) Actual current: I = 2.9 / 270 = 10.74 mA Resistor power: P = I^2 R = 0.01074^2 x 270 = 31.1 mW (a 1/4 W resistor is plenty) LED power: P = Vf x I = 2.1 x 0.01074 = 22.6 mW (b) Red LED (Vf = 1.9 V) on a 3.3 V pin, about 8 mA R = (3.3 - 1.9) / 0.008 = 1.4 / 0.008 = 175 ohm Next E12 value up: 180 ohm Actual current: I = 1.4 / 180 = 7.78 mA Spread between LED samples (same 180 ohm resistor): Vf = 1.7 V: I = 1.6 / 180 = 8.89 mA Vf = 2.1 V: I = 1.2 / 180 = 6.67 mA The current moves from 6.7 to 8.9 mA (about 2.2 mA, roughly +/-15 %) for a +/-0.2 V change in Vf, because only 1.4 V sits across the resistor. At 5 V (3 V across the resistor) the same +/-0.2 V would change the current by only about +/-7 %. Less headroom means less stable current. (c) Four red LEDs (2.0 V each) in series on 12 V at 15 mA Total LED drop: 4 x 2.0 = 8.0 V R = (12 - 8.0) / 0.015 = 4.0 / 0.015 = 266.7 ohm -> E12 up: 270 ohm Actual current: 4.0 / 270 = 14.81 mA Resistor power: 4.0^2 / 270 = 59.3 mW (1/4 W is fine) Four blue LEDs: 4 x 3.2 = 12.8 V, which is MORE than the 12 V supply, so no current can flow properly: it cannot work. (Three blue LEDs need 9.6 V: R = (12 - 9.6)/0.015 = 160 ohm, E12 up: 180 ohm. For four you need at least 12.8 V plus some headroom for the resistor, for example 15 V.) (d) Multiplexed 4-digit display Duty cycle per digit = 1/4 = 25 % (one digit on at a time). Average = peak x duty, so peak = 5 mA / 0.25 = 20 mA (the LED's maximum: do not go higher). Resistor on 5 V with red LEDs (Vf = 2.0 V): R = (5 - 2.0) / 0.020 = 150 ohm (an E12 value; no rounding). Frame rate 100 Hz, so one frame = 10 ms and each digit is on for 10 ms / 4 = 2.5 ms. Perceived brightness matches a steady 5 mA LED. (Peak power per segment: 2.0 x 0.020 = 40 mW for 2.5 ms.) Checklist - Use Vs - Vf, not Vs, for the voltage across the resistor. - Round R up to E12, then recompute the real current with the value you will fit. - Series LEDs: add the Vf values and check that the supply is larger. - Parallel LEDs: one resistor per LED. - Multiplexing multiplies the peak current by the number of groups (here 4), but never beyond the LED maximum.