Level 3 · Sense · project 15 of 17 · 30 min · ●●●○○
Night Doorbell
A doorbell that only works at night. The ring button fires buzzer and LED together — but only once the LDR sees darkness. In daylight the button does nothing.
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
- 8× Jumper wires L1
- 1× Light sensor (LDR) the gate — sits on the BOTTOM of the base divider so dark climbs the middle node up
- 1× 10 kΩ resistor the top of the base divider L1
- 1× 1 kΩ resistor protects the transistor base L1
- 1× 220 Ω resistor LED safety resistor on the output lane L1
- 1× Push button (tactile) the ring — gates both output lanes from the + rail L1
- 1× NPN transistor (2N2222) flat face toward you: legs are E-B-C
- 1× Active buzzer (3–5 V) + leg toward the ring button; no safety resistor needed on this lane L2
- 1× Red LED (5 mm) the "night visible" indicator — fires in parallel with the buzzer L1
you'll learn: Voltage dividers · Transistor switching · Series & parallel · Ohm's law · LED polarity · Switches
Circuit map
The circuit you'll build, running on the Workbench right now — shown with the switch closed and the lights off.
simulating…
If it doesn't work
The boring ways this circuit actually breaks — check these first before you unwire everything.
- Pressing the button in a dark room does nothing — silent and dark. Transistor pin order. Flat face toward you, legs are E-B-C left to right. If base and collector are swapped, the collector-to-emitter path is open even when 'saturated'. Pull the transistor and reseat it with the flat face aligned.
- Buzzer rings and LED lights even in a bright room. The LDR is on the wrong side of the divider (on TOP instead of BOTTOM), so V_middle climbs in bright light and the transistor saturates. Swap the 10 kΩ and the LDR so the LDR sits closer to the − rail.
- Alarm fires continuously — buzzer sounds the moment the battery is connected, no button needed. The ring button is wired across the + rail (shorting the + rail to the top of the output lanes always), or you missed inserting the button altogether. The button must be IN SERIES with the + rail feeding the output lanes.
- In a dark room with button pressed, LED lights but buzzer stays silent. Buzzer polarity. + leg of the buzzer must face the ring button; − leg faces the transistor collector. Flipped buzzer stays silent even with a healthy loop.
- In a dark room with button pressed, buzzer rings but LED stays dark. LED polarity. Long leg of the LED must face the 220 Ω; short leg faces the collector. Reversed LED stays dark while the buzzer lane is unaffected (lane independence).
- The LED is a dim pinprick in the dark; buzzer buzzes fine. The 220 Ω and the LED are swapped in position, or you're using a 1 kΩ or 10 kΩ in the LED lane. Colour bands: brown-black-red = 220 Ω.
- Alarm takes a few seconds to settle at dusk — buzzer chatters. That's the analog mush zone — the transistor fades in through its linear region at the wake-up threshold. Normal at Level 3; the 555 chip at Level 6 is the fix for crisp transitions.
What you're building
A doorbell that keeps its mouth shut during the day. All the normal parts of a doorbell are still here — a push button at the door, a buzzer inside the house, a red LED next to the buzzer so a late-night visitor can see the ring was received. The twist: a light sensor (LDR) sits across the base of the transistor and arms the whole alarm. Bright room: pressing the ring does nothing. Dark room: ring makes buzzer and LED fire together, same as Dusk Chorus.
This is the first project that puts two gates in series on an output. The transistor is a gate (it needs the room to be dark). The push button is a gate (it needs a human to press). Only when both agree does any current reach the buzzer or the LED. It's the Two-Hand Bell idea from Level 2, lifted up a level: one of the hands is now the sun.
The big idea: the transistor is an AND partner for the ring button
So far, every L3 sensor project you've built has fired as soon as the sensor crossed its threshold. The LDR saw the dark; the LED came on. Pressing a button wasn't part of the story.
Here the button sits in the collector lane — in series with the buzzer and the LED on the + rail side. For current to flow from
- to −, the loop needs both:
- the transistor saturated (collector-to-emitter looks like a wire ≈ 0.2 V) — which only happens when the LDR is dark, and
- the button closed — which only happens when a visitor presses.
Open either one and the loop breaks. The outputs stay silent in daylight no matter how many times a passer-by pokes the button, and silent at midnight unless someone actually rings.
The sensing half — same brain as Automatic Night Light
The base divider is the one you built for Automatic Night Light: 10 kΩ on top, LDR on the bottom, with a 1 kΩ base resistor feeding the transistor. Nothing new here — read that project first if the next few lines don't click.
- Bright room, LDR ≈ 1 kΩ: V_middle = 4.5 × (1 ÷ 11) ≈ 0.41 V. Below the 0.7 V wake-up line. Transistor off, collector floats.
- Dark room, LDR ≈ 100 kΩ: V_middle tries to climb toward 4.5 × (100 ÷ 110) ≈ 4.1 V. The base-emitter junction clamps at ~0.9 V and drinks the extra push as base current (~0.32 mA through the 1 kΩ base resistor). The transistor saturates, hard.
The LDR has no idea the ring button exists. The brain decides "night" or "day" purely from how bright the room is.
The deciding half — buzzer AND LED, gated by the ring button
Once the transistor is saturated, both output lanes can light up — if the ring button is also closed. Each lane sits on top of the + rail through the button, and both lanes return via the collector:
- Buzzer lane: + → ring button → active buzzer → collector → −. The buzzer behaves like ~150 Ω, and the transistor drops ~0.2 V in saturation. So 4.5 − 0.2 = 4.3 V sits across the buzzer: current = 4.3 ÷ 150 ≈ 29 mA. Full-volume beep, exactly like Doorbell.
- LED lane in parallel: + → ring button → 220 Ω → red LED (long leg toward the 220 Ω) → collector → −. KVL: 4.5 − 0.2 − 2.0 (red Vf) = 2.3 V across the 220 Ω. I_LED = 2.3 ÷ 220 ≈ 10 mA. The usual First-Light brightness, minus the small bite the transistor takes.
- Collector current: 29 + 10 ≈ 39 mA, well under the ~48 mA ceiling that the 0.32 mA base drive buys (β ≈ 150). Transistor stays in saturation.
The truth table — one row per sensor-and-button combination
Four combinations, one outcome each:
| LDR says | Button | Transistor | Loop | Buzzer + LED |
|---|---|---|---|---|
| bright | up | off | open at transistor | silent and dark |
| bright | down | off | open at transistor | silent and dark |
| dark | up | saturated | open at button | silent and dark |
| dark | down | saturated | closed everywhere | ring + glow |
Only the last row fires anything. Both gates have to agree.
Where "arm by sensor, ring by hand" shows up
- Motion-triggered security doorbells keep the chime silent during the day and only ring if the IR sensor is also tripped. Same pattern: sensor as the arm, button as the fire.
- Child-safety car window buttons only work when the key is at "accessory" or "run" (the car's electronics are the sensor). Buttons on their own do nothing when the car is off.
- Smart home night modes (Google Home, Alexa) that only ring the front doorbell between 7 am and 10 pm are software versions of this hardware circuit — a time gate ANDed with the physical button.
Any time you've seen a device "only respond under some condition and also when I ask", there was a transistor (or its software equivalent) somewhere in the loop, with a sensor on one side and a button on the other.
🧠 Your challenge
No single right answer. That's the point.
- Reverse the LDR gate — ring only in the DAY. Swap the 10 kΩ and the LDR positions in the divider (LDR on top, 10 kΩ on bottom) and press the button in both light levels. (Now the alarm is armed in daylight and dead at night — the brain is Sunrise Alarm's, the output lanes are unchanged. Great for a lunch-break buzzer that goes silent after sunset.)
- Add a second output lane. Fan a green LED + 220 Ω off the collector, in parallel with the existing lanes. What's the new collector current when the alarm fires? (29 mA buzzer + 10 mA red + 9.5 mA green ≈ 48.5 mA. Right at the edge of the transistor's saturation capacity for a 0.32 mA base drive. If the LED looks dim or flickers, drop the base resistor to 220 Ω to buy more collector capacity — the fix Warm Hand Chorus used.)
- Make the LDR less jumpy. Add a 1 kΩ in series with the LDR on the bottom of the divider (same trick as Curfew Beeper). How does the arming threshold move? (The daylight V_middle rises from 0.41 V to about 0.75 V — right at the transistor's wake-up line. In marginal shade the alarm now stays on the edge of firing; real sunset is still a hard trigger. Shows how divider arithmetic tunes the "when" of an arming gate.)
- Add a slide switch as a mute. Put a slide in series with the buzzer lane (between the ring button and the buzzer's + leg) — the Hidden Mute pattern from Level 2. Now a dark-room ring lights the LED but can be silenced. Lane independence, applied to an L3 arming circuit. (The LED lane doesn't care; it still fires at 10 mA. The buzzer lane is now gated by three things in series: dark, button, slide.)
- Would a slide switch work instead of the push button? Yes electrically, but which doorbells use slides and which use pushes? (Pushes are better for doorbells because the "ring" is a moment, not a state. A slide would latch the alarm on until someone remembers to switch it off — a flat tyre on the battery. Momentary buttons kinder on the battery for anything that fires for seconds, not minutes.)
- Why doesn't the LED fire during the day when the button is pressed? Trace the loop with your eye. (The button-closed path from + → 220 Ω → LED → collector dead-ends at the collector — the transistor is open, so the collector is floating. Floating means no current, means no voltage across the LED. The LED sees 0 V and glows nothing. The AND is proved by physics, not by any "logic" chip.)
For grown-ups: safety notes
- Battery-safe end to end. The loudest state (dark room + button pressed) draws about 40 mA plus whatever base current the divider pulls — call it 40 mA at 4.5 V, a 180 mW load. Three AAs deliver that all day without warming up.
- Daytime standby draws microamps from the LDR branch. You can leave the project set up on a shelf for weeks with no measurable battery hit.
- The buzzer is loud at close range. First press, point the buzzer away from faces and warn anyone nearby. 29 mA at 3 cm is a startle- loud beep.
- Nothing in the loop should get warm. If the 220 Ω feels obviously warm, trace the LED lane — the LED is probably reversed and the 220 Ω is dropping the full 4.3 V (which is 84 mW, still inside its 250 mW rating but on the way up).
- Transistor pins: flat face toward you, legs E-B-C left to right. Base goes to the 1 kΩ base resistor; collector shares the row with the output lanes' return legs; emitter goes to the − rail. Scramble these and the alarm either stays always-on (base and emitter swapped) or never fires at all (base and collector swapped).
- LED polarity: long leg toward the 220 Ω, short leg toward the collector. A reversed LED stays dark regardless; the buzzer still fires normally.
- Buzzer polarity: + leg toward the ring button, − leg toward the collector. Flipped buzzer stays silent even when everything else is right.
- Never wire this to mains. Battery-only.
Checked against
Keep building
You might also like
shares ideas with this one