50. Automatic darkness indicator

Circuit

Loading simulator…

Design Approach

A dark environment should switch on an LED without software. A light-dependent divider controls the base of an NPN transistor, which supplies the LED current only when illumination is low.

How the Circuit Works

  1. Generate a light-sensitive base voltage. The solution adds R_PULL = 15 kΩ from VCC = 5 V to the base-control node. The supplied LDR1 connects that node to ground.
  2. Turn on in darkness. In low light, the LDR resistance increases. The base node rises enough to forward-bias the supplied NPN Q1, letting it sink current from the LED branch.
  3. Limit LED current. The solution adds R_LED = 470 Ω in series with the supplied red LED1 from VCC to Q1's collector. With the transistor saturated, approximate LED current is 5−1.8−0.2470≈6.4mA\frac{5 - 1.8 - 0.2}{470} \approx 6.4\,\mathrm{mA}, inside the 5–10 mA requirement at 20 lux.
  4. Turn off in bright light. As lux increases, LDR1 falls in resistance and pulls the transistor base toward ground. At 200 and 500 lux, Q1 remains off and LED current must be below 0.1 mA.

Verify the Circuit

Set LDR1 to 20, 200, and 500 lux. Check LED current of 5–10 mA in the first case and below 0.1 mA in both brighter cases. As an experiment, change R_PULL to shift the effective darkness threshold.

Key Learnings

  • A sensor divider can directly control a transistor to make a simple autonomous detector.
  • The divider sets the switching threshold, while the separate LED resistor sets output current.