LearnTronics
Automatic Nightlight with Delay
Recipe #25 — automatic nightlight with delay
The light-controlled switch can be improved by adding capacitance. An LDR senses darkness, a capacitor slows rapid changes, and a comparator makes a clean decision.
Bright: the LDR has low resistance and pulls the sense voltage down. Dark: LDR resistance rises, the sense voltage rises, and after C1 has charged far enough the comparator turns the nightlight on.
Why add C1?
Without C1, a brief shadow or flicker can move the sense voltage across the threshold immediately. C1 slows that change. The nightlight therefore responds to a sustained change in light rather than every tiny disturbance.
Delay and hysteresis solve different problems
An RC delay slows changes with time. Comparator hysteresis creates separate ON and OFF thresholds. Practical sensor switches often use both so they neither react too quickly nor chatter near the switching point.