class: center, middle, inverse, title-slide .title[ # Milestone: Automatic Nightlight ] .subtitle[ ## Programmable Electronics — Unit 1 ] .date[ ### Class 10 ] --- # Learning Targets .lt-box[ - Combine a photoresistor voltage divider, a transistor switch, and an LED into a working automatic nightlight. - Justify every component value chosen, using the concepts learned this unit. - Diagnose and fix a non-working build systematically, using the Debug Ladder. - Document and demo the finished circuit. ] .eu-label[Essential Understanding:] Every idea from this unit — Ohm's law, series and parallel, dividers, sensors, switching — was one piece of a bigger machine. Today you build the whole machine, and it either works or you find out why not. --- # Agenda .agenda-box[ 1. Recap: everything you've learned, in one circuit 2. The target schematic 3. Milestone grading, and the points breakdown 4. **Build day** — most of the period 5. Document and demo ] --- # Everything you've learned, in one circuit - **Class 2–3:** Ohm's law sizes the LED's resistor so it lights up without burning out. - **Class 4:** series/parallel and proper multimeter technique — how you'll verify your build. - **Class 5:** reading a schematic and building it on a breadboard, without step-by-step instructions. - **Class 6:** the voltage divider and the photoresistor — a resistance that changes with light, dropped into a divider for a useful midpoint voltage. - **Class 8:** the capacitor and RC timing. - **Class 9:** the transistor — a small current at the base switching a larger current to the LED. Today, all six become one device. --- # Resolving Class 6's open question Class 6 asked: should the photoresistor sit on top (`\(R_1\)`) or the bottom (`\(R_2\)`) of the divider? We want `\(V_{out}\)` to rise as it gets **darker**, so that rising voltage can turn the transistor **on**. `$$V_{out} = V_{in} \times \frac{R_2}{R_1 + R_2}$$` If the photoresistor is `\(R_2\)` (the bottom resistor), `\(V_{out}\)` rises as its resistance rises in the dark — exactly what we want. **The LDR goes on the bottom.** --- # The target schematic .center[ <img src="assets/schematics/automatic-nightlight.svg" alt="Photoresistor divider — R1 (~10 kohm) on top, R2 (LDR) on the bottom — its midpoint feeding a 4.7 kohm base resistor into NPN transistor Q1; the collector drives an LED and 220 ohm resistor from +6 V; emitter to ground" style="max-height:400px;"/> ] --- class: small-font # Milestone grading, for this build Same five dimensions as always, adapted for a pre-code circuit: - **Function** — does it turn the LED on in the dark and off in the light? - **Circuit craft** — legible wiring, correctly sized resistors, sound power distribution. - **Documentation** — could another student rebuild this from what you produced? - **Diagnosis** — can you explain a failure you hit, how you found it, and how you fixed it? (Graded even if it worked perfectly the first time — describe what you checked for.) *(No code yet — "Code craft" starts once we reach microcontrollers in Unit 3.)* --- class: center, middle # Build day Most of the period is yours. Work through these steps with your partner. --- # Build day steps 1. Draw your own copy of the target schematic in your notebook. Choose your resistor values and **justify each one**: the LED resistor (Ohm's law → 220 Ω), the base resistor (limits base current → start at 4.7 kΩ), and a starting guess for `\(R_1\)` (≈ 10 kΩ — you'll tune it in step 4). 2. Build the sensing half alone first: `\(R_1\)` and the photoresistor. Measure `\(V_{out}\)` in light and covered — confirm it swings the way you expect. 3. Add the transistor and LED. Confirm the LED turns on when you cover the sensor, off when you uncover it. 4. **Tune it:** if the LED triggers at the wrong brightness, adjust `\(R_1\)` and re-test. Record what you changed and why. 5. Hit a problem? Work the Debug Ladder before asking for help: check power, check for a common ground, measure — don't guess, halve the circuit to isolate the fault. 6. **Document:** your schematic, a photo of the build, a one-paragraph "how it works," and one thing you'd improve. 7. **Demo it** — cover the sensor and show the LED respond — to your partner group and to me. --- class: small-font # Auto Nightlight — grading points | | Points | |---|---| | **Minimum build** — LED responds to light, wiring is sound, documented and demoed | **24,000** | | Extra components used meaningfully — button, capacitor, potentiometer, DIP switch | **+2,000** | | Clean schematic of *your* build, drawn to standard | **+3,000** | | Social-media-style video explaining how it works | **up to +4,000** | | **Maximum** | **39,000** | .font-small[ The minimum build is the whole milestone — the three add-ons are optional and stack on top. An "extra component" only counts if it does something (a capacitor that smooths the light/dark threshold, a pot in place of a fixed `\(R_1\)`), not just parked on the board. ]