Circuit and working of Little Nightlight
Circuit diagram for the nightlight is shown in Fig. 2. It is built around three resistors (R1 through R3), two light-emitting diodes (LED1 and LED2), a light-dependent resistor (LDR1), a BC548 transistor (T1) and a capacitor (C1). Here LED1 is blue and LED2 is RGB with rainbow effect.
The circuit operates off 230V AC, consuming very little current. The generic 5mm LDR drives the rainbow LED (LED2) through npn transistor T1. Series resistor R3 (150-ohm) limits the current through LED2. The sensor circuit ensures that the rainbow light switches on when it gets dark and off when there is ambient light. If desired, you can change its detection threshold by varying the value of 47-kilo-ohm resistor R2.
Resistor R1 (100-kilo-ohm), 1N4007 diode D1, and 4.7µF, 16V electrolytic capacitor C1 are used to down-convert the 230V AC input supply to a very low-value DC supply. The 5mm blue LED (LED1) not only works as an always-on pilot lamp but also keeps the voltage across buffer capacitor C1 close to around 3V. When the circuit is in active state (that is, in darkness), LED1 also produces a waving effect in tune with the current consumption of the entire circuitry.
The rainbow LED is a low-cost flashing LED with inbuilt driver chip. When power is applied, it flashes red, blue and green colours each for several seconds, then it slowly mixes these colours together to form other colours. Fig. 3 shows the author’s lab experiments.
Construction and testing
An actual-size PCB layout for the little nightlight is shown in Fig. 4 and its components layout in Fig. 5. After assembling the circuit, enclose it in a suitable box.
Download PCB and component layout PDFs: click here
Fix CON1 so that you can connect 230V AC easily. Connect LDR1 such that light from LED1 and LED2 doesn’t fall on it. After proper assembly and connections, your little nightlight circuit is ready to use. Proposed enclosure is shown in Fig. 6.