This automatic door light switch circuit turns ON a lamp when a door is opened then turns it OFF when the door is opened again. The working principle of the light switch is quite simple. The bistables inside CMOS 4013 are conected in series. FF2 is configured as a R-S memory to store the state of the switch. S1 must switch as soon as the door opens that is why it will be mounted on the door jamb.
When the door will be opened FF2 is registered and its output (pin 13) will be 1.
This output, connected at the tact entry of FF1 (pin 3) will open T1 and activate the relay switching ON the light.
When the door is closed nothing will happen because FF2 is unregistered and its output (pin 13) passes in state “0”. Only when the door is opened again, FF1 will change its state and the output at pin 1 will block the transistor so the relay will be disconnected and the door light switch turns off the lamp.
The relay must operate at voltages between 5 V and 15 V.