Level 3 · Sense · project 2 of 12 · 25 min · ●●●○○
Sunrise Alarm
The night light — flipped. Swap two parts and the LED wakes up with the sun instead.
new here? Start with First Light — one battery, one resistor, one LED. It teaches the loop, LED direction, and why the 220 Ω resistor matters.
What you need
- 1× 3×AA battery pack (4.5 V) L1
- 1× Solderless breadboard L1
- 6× Jumper wires L1
- 1× Light sensor (LDR) lives on TOP of the divider this time
- 1× 10 kΩ resistor moved to the BOTTOM L1
- 1× 1 kΩ resistor protects the transistor base, as usual L1
- 1× NPN transistor (2N2222) flat face toward you: legs are E-B-C
- 1× Red LED (5 mm) L1
- 1× 220 Ω resistor L1
you'll learn: Voltage dividers · Transistor switching · Ohm's law
Circuit map
The circuit you'll build, running on the Workbench right now.
simulating…
If it doesn't work
The boring ways this circuit actually breaks — check these first before you unwire everything.
- LED never lights, even at sunrise. Divider is wrong. In this project the LDR sits on TOP (opposite of Automatic Night Light). Swap the LDR and the 10 kΩ.
- LED always on, day or night. You've built the Night Light wiring instead. Swap the LDR and 10 kΩ so the LDR is on top.
- Doesn't switch at all. 2N2222 pins E-B-C, flat face toward you. Swap any two and the base can't turn it on. Confirm the base 1 kΩ is also in place.
- Dim LED when on. Wrong resistor in the LED lane. 220 Ω = red-red-brown.
- Fires at odd times of day. Your morning brightness differs from the design. Nudge the bottom 10 kΩ, or move to Reading Light for a knob.
What you're building
Take everything from the Automatic Night Light and swap exactly two parts — the 10 kΩ resistor and the LDR trade places in the divider. That one swap flips the whole circuit upside-down. Instead of the LED turning on when the room gets dark, it now turns on when the room gets bright. Great for a wake-up-with-the-sun light on your windowsill.
If the night light was Challenge #1 of that project, this is the answer — worked out and built.
Why swapping two parts inverts everything
The voltage divider is the same equation you already know:
middle voltage = 4.5 V × (bottom ÷ (top + bottom))
A bigger resistance on the bottom lets the middle voltage rise. A bigger resistance on the top holds it down. Trade top and bottom and you trade "lets it rise" with "holds it down" — a total role reversal.
- Night light: 10 kΩ on top, LDR on bottom. Dark → LDR big → big bottom → middle pulled up toward 4.5 V → transistor on.
- Sunrise (this project): LDR on top, 10 kΩ on bottom. Bright → LDR small → the top hardly holds anything back → middle pulled up toward 4.5 V → transistor on.
The rule stays the same: "middle voltage rises → transistor turns on." The trigger condition flips. You can rearrange circuits to change what they detect, without changing what they do with the answer.
Do the math
Numbers make it concrete. LDR is roughly 1 kΩ in bright light and ≈ 100 kΩ in darkness (its official range on the datasheet — this matches your night-light figures).
- Bright morning: LDR ≈ 1 kΩ on top, 10 kΩ on bottom → middle tries to reach 4.5 × (10 ÷ 11) ≈ 4.1 V. Well past the 0.7 V wake-up line, so the transistor turns on hard and the LED lights.
- Night: LDR ≈ 100 kΩ on top, 10 kΩ on bottom → middle sits at 4.5 × (10 ÷ 110) ≈ 0.41 V. Below the 0.7 V line, so the transistor stays off and the LED is dark.
(An honest wrinkle for the bright case: the LDR at 1 kΩ is a low resistance for a divider, so it can shove in way more current than the base junction can drink. The base gulps what it needs at 0.7 V and the 1 kΩ base resistor mops up the rest — the middle ends up sitting well above the wake-up line, around 2.5 V in simulation, with the transistor saturated. All that matters for the LED is that we're comfortably past 0.7 V; the exact height doesn't change the answer.)
Build it
You already own this build — it's the Automatic Night Light with two parts swapped. If yours is still on the breadboard, just pull the 10 kΩ and the LDR and put each in the other's holes.
Fresh build:
- The sensing half (INVERTED): battery + → LDR → middle row → 10 kΩ → battery −. Compare to the night light's "10 kΩ over LDR" — this is the same two parts, top and bottom traded.
- The deciding part: transistor flat face toward you, legs are E-B-C. Middle row → 1 kΩ → Base.
- The output half: battery + → 220 Ω → LED (long leg first) → Collector; Emitter → battery −.
- Cover the LDR: LED off. Shine a phone flashlight on it: LED on.
The lesson the swap teaches
The two circuits share every other part — same transistor, same base resistor, same LED lane, same 4.5 V supply. Only the sensor half is different, and only inside the divider. This is how larger circuits get built. Once you know a good "decider" pattern (here, "divider → transistor → LED"), swapping the front end lets you detect a different thing: light, temperature, sound, or moisture. The back end stays exactly the same. At Level 8 you'll do the same swap with a soil moisture sensor.
🧠 Your challenge
No single right answer. That's the point.
- Predict, then measure. Cover the LDR halfway with a bit of paper. Guess whether the LED will be on, off, or partly lit before you look. Where does the divider's middle voltage land at that in-between light?
- Make it fussier. Add a 1 kΩ in series with the LDR on the top half. What does the math say happens to the middle voltage in the same bright light? Does it still cross the 0.7 V line?
- A "closet-open" alarm. Combine this circuit with the Door Buzzer: put an LED and a buzzer both on the collector lane. Now when someone opens the closet and light rushes in, it beeps and glows. Which project supplies which half of the circuit?
For grown-ups: safety notes
- Battery-safe voltages throughout — the sensor doesn't change that.
- Cover the LDR with your hand or a small piece of tape to test darkness — never point the LDR at the sun through a window lens or magnifier.
- If the transistor ever feels warm to the touch, disconnect the battery and re-check E-B-C leg order. Backwards transistors are always the first suspect.
- The LED lane pulls its usual ~11 mA when lit. The sensing half adds about 2 mA in bright light (roughly 0.25 mA down the 10 kΩ and 1.7 mA into the base through the 1 kΩ) and only about 40 µA in the dark — a set of AA batteries will happily run this for many mornings.
Checked against
Keep building
You might also like
shares ideas with this one