class: center, middle, inverse, title-slide .title[ # Ohm’s Law, LED Driver Circuit, resistance ] .subtitle[ ## Programmable Electronics — Unit 1 ] .date[ ### Class 3 ] --- class: center, middle # LED Driver circuit Putting voltage, current, and resistance to work in a very simple circuit. --- # What is an LED, really? .pull-left.w60[ - LED = Light-Emitting Diode. A diode only lets current flow in **one direction**. - An LED has a **forward voltage** (`\(V_f\)`) — roughly fixed, depends on color: - Red ≈ 2.0 V, Green ≈ 2.1 V, Blue/White ≈ 3.0–3.2 V - Below `\(V_f\)`: effectively no current flows, no light. - Above `\(V_f\)`: current rises **very fast** for a tiny increase in voltage. If you connect an LED straight to a supply above roughly 3 V with nothing else in the circuit, current keeps rising until the LED burns out. ] .pull-right.w30[ <img src="assets/led-fvoltage.png" alt="LED forward-voltage curve: current rises sharply above the forward voltage." height="500"/> ] --- # The fix: a current-limiting resistor .pull-left.w30[ - Put a resistor in series with the LED. - The resistor "absorbs" the extra voltage the LED doesn't use, and limits the current to a safe value. - This is the **LED driver circuit** — the simplest one you'll build all semester, and the one every other circuit today builds on. ] .pull-right.w60[ <img src="assets/LED-driver.png" alt="A working LED circuit with a current-limiting resistor in series." width="100%"/> Supply → Resistor → LED → Ground ] --- # Ohm's Law `$$V = IR$$` Where: - `\(V\)` = voltage, in volts - `\(I\)` = current, in amps - `\(R\)` = resistance, in ohms (`\(\Omega\)`) Solved for resistance, since we're picking `\(R\)`: `$$R = \frac{V}{I}$$` --- # Exercises 1. Calculate the **nominal** current flowing through your LED, considering: - Source voltage of `\(6\,\text{V}\)` (`\(4 \times 1.5\,\text{V}\)`) - Resistance of `\(220\,\Omega\)` 2. Calculate the **real** current flowing through your LED, considering: - Your *real* source voltage (measure it with a multimeter). - The *real* resistance value of the resistor (measure it with a multimeter). Write your answers in your notebook. --- # Exercises (solution) 1. Calculate the **nominal** current flowing through your LED, considering: - Source voltage of `\(6\,\text{V}\)` (`\(4 \times 1.5\,\text{V}\)`) - Resistance of `\(220\,\Omega\)` Using Ohm's Law... `$$I = \frac{V}{R}$$` `$$I = \frac{6\,\text{V}}{220\,\Omega} = 0.02727\,\text{A} = 27.27\,\text{mA}$$` 2. Calculate the **real** current flowing through your LED, considering: - Your *real* source voltage (what value did you measure?) - Your *real* resistance (what value did you measure?) --- class: center, middle ### How do we know what resistor value will light the LED safely? What would we need to know? ### How many electrons pass through the LED in one second? How can we figure this out? Talk it over with your partner for one minute. --- # LED datasheet ### Current <img src="assets/led-current-datasheet.jpeg" alt="LED datasheet excerpt showing rated current." width="100%"/> --- ### Voltage <img src="assets/led-voltage-datasheet.jpg" alt="" width="100%"/> --- # Sizing the resistor for an LED The resistor only sees the voltage the LED *doesn't* use, and needs to pass the current we want the LED to run at: `$$R = \frac{V_{supply} - V_{f}}{I_{LED}}$$` **Worked example:** 6 V supply (our 4×1.5 V battery pack), red LED (`\(V_f \approx 2.0\,\text{V}\)`, rated forward current `\(I_f = 20\,\text{mA}\)` from the datasheet): `$$R = \frac{6\,\text{V} - 2.0\,\text{V}}{0.020\,\text{A}} = \frac{4\,\text{V}}{0.020\,\text{A}} = 200\,\Omega$$` We'll round **up** to the nearest resistor we actually have — the 220 Ω in your kit. Rounding up means *less* current than calculated, which is the safe direction. That's exactly the resistor you already used in the Exercises. --- # Try it yourself With your partner, calculate `\(R\)` for: 1. A 9 V supply, green LED (`\(V_f = 2.1\,\text{V}\)`), target current 15 mA. 2. A 5 V supply, blue LED (`\(V_f = 3.0\,\text{V}\)`), target current 20 mA. Show your work in your notebook: the formula, the numbers plugged in, and the final answer rounded up to a standard resistor value. --- # How many electrons is that? Back to our second question: how many electrons pass through the LED every second? Recall: **1 amp** means about `\(6.242 \times 10^{18}\)` electrons pass a point every second — that's the definition of the amp. Our LED's nominal current (from the Exercises): `\(I = 27.27\,\text{mA} = 0.02727\,\text{A}\)` `$$\text{electrons per second} = I \times 6.242\times10^{18}$$` `$$= 0.02727\,\text{A} \times 6.242\times10^{18} \approx 1.70\times10^{17}$$` That's about **170 quadrillion electrons every second** — through one small LED, at a current so low you can safely touch the circuit. --- # Reading a resistor: the color code Resistors are too small to print numbers on, so they use **color bands** instead. A standard 4-band resistor: - Band 1: 1st digit - Band 2: 2nd digit - Band 3: multiplier (how many zeros) - Band 4: tolerance (how close to the stated value it actually is) --- # Digit colors <div style="line-height: 2.6;"> <span class="swatch" style="background:#000000; color:#fff;">Black = 0</span> <span class="swatch" style="background:#8B4513; color:#fff;">Brown = 1</span> <span class="swatch" style="background:#FF0000; color:#fff;">Red = 2</span> <span class="swatch" style="background:#FFA500; color:#000;">Orange = 3</span> <span class="swatch" style="background:#FFFF00; color:#000;">Yellow = 4</span> <span class="swatch" style="background:#008000; color:#fff;">Green = 5</span> <span class="swatch" style="background:#0000FF; color:#fff;">Blue = 6</span> <span class="swatch" style="background:#8F00FF; color:#fff;">Violet = 7</span> <span class="swatch" style="background:#808080; color:#fff;">Gray = 8</span> <span class="swatch" style="background:#FFFFFF; color:#000;">White = 9</span> </div> Band 3 (multiplier) reuses this same color scale as "×10^n" — Black is ×1, Brown is ×10, Red is ×100, and so on — plus two colors unique to the multiplier band: <span class="swatch" style="background:#D4AF37; color:#000;">Gold = ×0.1</span> <span class="swatch" style="background:#C0C0C0; color:#000;">Silver = ×0.01</span> --- # Worked example: reading a resistor **Yellow – Violet – Red – Gold** - Band 1 (Yellow) = 4 - Band 2 (Violet) = 7 - Band 3 (Red) = ×100 - Band 4 (Gold) = ±5% tolerance `$$47 \times 100 = 4{,}700\,\Omega = 4.7\,\text{k}\Omega$$` So this resistor is **4.7 kΩ, ±5%**. --- # Your turn: decode these Work in your notebook. For each, give the value in ohms and the tolerance. 1. Red – Red – Brown – Gold 2. Brown – Black – Orange – Gold 3. Green – Blue – Red – Silver 4. Orange – Orange – Black – Gold When you're done, label each resistor in your kit with its value. --- # Build: The Brightness Ladder Putting resistance to work — literally, in light. With your partner, using your breadboard and the 6 V battery pack: 1. Pick five resistors of different values from your kit (e.g. 100 Ω, 220 Ω, 470 Ω, 1 kΩ, 4.7 kΩ) — decode each one's color bands first, don't trust the bin label. 2. Wire one LED in series with each resistor, all five branches sharing the same 6 V rail and a common ground. 3. **Predict first:** in your notebook, rank the five LEDs from brightest to dimmest, and explain why, using Ohm's law. 4. Power on. Rank what you actually see. Did it match your prediction? 5. Measure the current through your brightest and your dimmest LED with the multimeter. Do the numbers back up the ranking?