This simple circuit can be used as an automatic bathroom lamp controller. It disables the bathroom lamp at daytime and enables it at night. The circuit is built around a light-dependant resistor (LDR1), reed switch (S1), two transistors BC547 (T1) and SK100 (T2), a 12V 1-change over (C/O) relay (RL1), a step-down transformer X1 (12V-0-12V, 250mA secondary) along with some discrete components.
The working of the circuit is based on the opening/closing of the bathroom door. When the bathroom door is closed, magnet comes near the reed switch and shorts its terminals. Both transistors T1 and T2 stop conducting, and neither relay RL1 energises nor CFL lamp (B1) glows.
When bathroom door is opened, magnet moves away from the reed switch and opens its terminals. Both transistors T1 and T2 conduct, relay RL1 energises and CFL lamp (B1) glows.
When bathroom door is opened, CFL lamp (B1) remains on. After entering the bathroom do not close the door completely. If the bathroom door is completely closed, lamp (B1) is switched off.
During daytime, lamp operation is not necessary due to the presence of sunlight so LDR1 is used. Fit LDR1 near the bathroom window where it can receive sunlight (reflected sunlight is enough). At daytime if you open the bathroom door, resistance of LDR1 reduces and keeps both transistors T1 and T2 in cut-off state. Relay RL1 does not energise and lamp remains off.
At night, if you open the bathroom door, resistance of LDR1 is high, which keeps both the transistors T1 and T2 in conducting state. Relay RL1 energises and lamp (B1) is switched on. The power supply required to operate the circuit is derived from transformer X1.
Assemble the circuit on a general purpose PCB and enclose in a suitable cabinet. Fix LDR1 near the bathroom window in such a way that maximum light falls on it at daytime. Fix the reed switch on the frame of bathroom door and magnet on the door. Keep the transformer inside the cabinet and place the unit above/near the bathroom door.