Level 3 · Sense · project 8 of 12 · 25 min · ●●●○○

Study Lamp

The Automatic Night Light with a force-on override — flip the slide switch and the lamp stays lit even in daylight, ignoring the sensor.

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

you'll learn: Voltage dividers · Transistor switching · Switches · Ohm's law

Circuit map

The circuit you'll build, running on the Workbench right now — shown with the lights off.

simulating…

If it doesn't work

The boring ways this circuit actually breaks — check these first before you unwire everything.

  • Override slide doesn't force the lamp on in daylight. The override should bridge from + directly to the LED lane (around the transistor). If it's wired into the sensor path, it can't override.
  • Lamp never comes on. 2N2222 pins E-B-C, flat face toward you. Then confirm the LDR is on the BOTTOM of the sensing divider (same as Automatic Night Light).
  • Lamp always on. Divider flipped — LDR on the bottom, 10 kΩ on top. Or the override slide is stuck closed.
  • LED very dim when on. Wrong resistor in the LED lane. 220 Ω = red-red-brown.
  • Slide toggles but nothing changes. Slide is on the outer-outer pair. Use the middle + one outer leg.

What you're building

Vacation Nightlight added a slide switch that can force the lamp off. This is its opposite: a slide switch that can force the lamp on.

Normal setting (switch open): the lamp is the Automatic Night Light — dark room means lamp on, bright room means lamp off. Study setting (switch closed): the lamp is lit no matter what the sensor sees. Perfect for a homework corner where you want the lamp on right now — even though the ceiling light is still on and the sensor thinks it's daytime.

The trick is a slide switch that reaches around the transistor and short-circuits its collector to its emitter. When that switch is closed, the LED lane can complete its loop without waiting for the transistor's permission.

The big idea: parallel path around the transistor

The transistor in Automatic Night Light is a gate: the LED lane's loop only closes when the transistor turns on. In the bright room the gate stays shut, so the LED stays dark even though the lane is wired end to end.

Put a slide switch in parallel with the transistor — one leg on its collector, one leg on its emitter — and you get a bypass. When that switch is open the circuit is normal Automatic Night Light. When that switch is closed, current has a second way to finish the loop: straight through the switch, ignoring the transistor entirely.

Look at the LED lane's two possible completions:

  • Path 1 (through the transistor): + rail → 220 Ω → LED → collector → transistor → emitter → − rail. Only usable when the sensor makes the transistor turn on.
  • Path 2 (through the override): + rail → 220 Ω → LED → collector → closed slide switch → emitter → − rail. Usable whenever the slide switch is closed. Always.

Either path alone is enough for the LED to fire — this is Two-Door Signal logic hidden inside a bigger circuit. Sensor OR override → lamp on.

Compare with Vacation Nightlight

You have two override projects now. They look similar and are the same physical trick — a slide switch in a bigger circuit — but they sit in different places and mean different things:

  • Vacation Nightlight: switch in series with the LED lane (up on the + rail, before the 220 Ω). Switch open = can't complete the LED loop, ever. Switch closed = normal auto behaviour. This is a force-off override — "no matter what the sensor thinks, keep the lamp dark."
  • Study Lamp: switch in parallel with the transistor (jumping around the sensor's decision). Switch open = normal auto behaviour. Switch closed = the LED loop can always complete. This is a force-on override — "no matter what the sensor thinks, keep the lamp lit."

Series-break = force-off. Parallel-bypass = force-on. Same slide switch, different job. Which one you build depends on the story: Vacation = "I'm leaving, stay dark." Study = "I'm reading, stay lit."

Do the math (four modes)

Auto, dark room (switch open, LDR ≈ 100 kΩ): identical to Automatic Night Light. Divider middle tries for 4.5 × 100 ÷ 110 = 4.1 V; the base clamps it around 1 V, transistor saturates, LED lane closes through the transistor. LED sees 4.5 − 2.0 (red LED) − 0.2 (V_CE(sat)) = 2.3 V across the 220 Ω → I_LED ≈ 10 mA. Comfortable glow.

Auto, bright room (switch open, LDR ≈ 1 kΩ): divider middle sits at 4.5 × 1 ÷ 11 ≈ 0.41 V — below the 0.7 V wake-up line. Base current: nearly zero. Transistor stays off, LED lane is broken at the collector, I_LED = 0. Battery draw is just the 0.4 mA through the sensing divider itself.

Study, bright room (switch closed, LDR ≈ 1 kΩ): the sensor still thinks it's daylight, and the transistor is still off. But the override slide switch is closed — it's a bit of wire between the collector and the emitter, resistance in the milliohms. So the LED lane now completes through the switch instead of the transistor. The LED sees 4.5 − 2.0 (red LED) = 2.5 V across the 220 Ω → I_LED ≈ 11 mA. A hair brighter than auto-dark, in fact — because the bypass wire drops the 0.2 V that the saturated transistor was still eating.

Study, dark room (switch closed, LDR ≈ 100 kΩ): both paths are available — the transistor is on and the override is closed. Current still splits somewhere between them, but the LED still sees the same 4.5 − 2.0 = 2.5 V across the 220 Ω, so I_LED ≈ 11 mA. Nothing pops — parallel paths never add more current to a fixed load; they just share the same total.

Build it

If your Automatic Night Light is already on the breadboard, this is a two-wire change. Add a slide switch with one leg on the transistor's collector row and the other leg on the transistor's emitter row.

Fresh build:

  1. Power rails: battery + to a top row, battery to a bottom row.
  2. The sensing half: + rail → 10 kΩsensing middle rowLDR rail.
  3. The base link: sensing middle row1 kΩ → transistor Base (middle leg, flat face toward you).
  4. The transistor: Emitter (left leg) → rail. Collector (right leg) → LED lane bottom row.
  5. The LED lane: + rail → 220 Ω → LED long leg → LED short leg → LED lane bottom row (which is the collector row).
  6. The override: slide switch straddling LED lane bottom row (collector) and the rail (emitter). Middle common leg on one side, one outer leg on the other. Slide it off for now.
  7. Test the four modes:
    • Uncovered LDR + switch off → dark (auto-bright, LED off).
    • Cover LDR + switch off → LED glows (auto-dark, ~10 mA).
    • Uncovered LDR + switch on → LED glows (study-bright, ~11 mA — override wins).
    • Cover LDR + switch on → LED glows (study-dark, ~11 mA — both paths open, same fixed-load current).

Why is study mode slightly brighter than auto-dark mode?

A tiny detail worth chasing. Look at the LED current numbers above: auto-dark ≈ 10 mA, study-anything ≈ 11 mA. That's because a saturated transistor still drops about 0.2 V from collector to emitter — the V_CE(sat) term in the datasheet. That 0.2 V is voltage the resistor doesn't get to see. When the override switch is closed, that 0.2 V drop is replaced by a real wire's ~0 V drop, so the 220 Ω sees a full 2.5 V across it instead of 2.3 V, and Ohm's law rewards the LED with a fraction more current.

That's not a bug — it's how real transistor bypasses work. In higher-power circuits (motor drivers, class-D audio) the "bypass transistor" losses vs "closed switch" losses matter a lot; car starter relays and power MOSFETs exist because a saturated bipolar transistor still burns milliwatts as heat, and a mechanical (or solid-state) short doesn't.

You're feeling the same tradeoff in your homework lamp. That's the whole subject compressed into 0.2 V.

🧠 Your challenge

No single right answer. That's the point.

  • Predict, then measure. Compute the LED currents for all four modes yourself using the numbers in the article. Write them down before you power the circuit up. If you have a multimeter, put it in series with the LED and check each mode. (Auto-bright should read ≈ 0 mA. The other three should all be in the 10–12 mA band, with study-bright the highest by a hair.)
  • Three-way lamp. Build both this and Vacation Nightlight on the same board: one slide switch in the LED-lane feed (force-off) and a second slide switch in parallel with the transistor (force-on). Now you have four modes: auto (both switches off), force-off (top switch off, override off), force-on (top switch on, override on), and one weird mode where the top switch is off. Fill in the four-mode table. Which slide switch position wins when they disagree?
  • Move the override. Try putting the parallel switch across the transistor's base and emitter instead — that shorts the base to ground when closed. What happens to the lamp when you flip it? (You've just built a force-off override in a different way. Parallel across the wrong pair kills the loop instead of completing it.)
  • Buzzer version. Rebuild it with the Cookie Jar Alarm's buzzer lane in place of the LED lane. Now the override forces the buzzer on — a "test the alarm" button that fires the buzzer even in daylight. Which lane changed, and which halves stayed the same? (Sensing half unchanged, output half swapped — the same "brain/mouth" trick you learned in Level 3.)
  • Why the transistor doesn't heat up. In study-dark mode, both paths are open. Predict where the current actually flows. (Hint: compare the transistor's V_CE(sat) with a closed slide switch's milliohms. Which path is 'easier'?)

For grown-ups: safety notes

  • Battery-safe throughout. Peak battery draw sits near 11 mA in any "lamp on" mode; a set of AAs runs this for a long week of homework.
  • Do not put the override across the battery's plus and minus rails. That short-circuits the pack directly — 4.5 V ÷ (a few milliohms of switch + wire + battery internal resistance) is amps. The pack gets hot fast, and the switch's contacts can weld. This project only touches the transistor's two lower legs (collector and emitter), never the battery rails themselves.
  • If the LED lights softly even with both LDR covered and switch off, you have a stray wire path. Walk the LED lane with your finger — anywhere your finger touches two rows that shouldn't be connected, that's the sneak path.
  • If the transistor warms up in study-dark mode, that's a sign the override wire has come loose and all the LED current is going through the transistor — 10 mA at 0.2 V is 2 mW, harmless, but something to notice. Wiggle the override switch and see if it cools. (If it's ever hot to the touch, disconnect and re-check E-B-C first — a backwards transistor gets hotter.)
  • Slide switch contacts don't wear out at these currents (rated ~0.3 A; we use 3–4% of that), so you can flip between modes as often as you like.

Checked against

Keep building