The schematic below shows a project of a proximity sensor relay switch using LDR and LED. The circuit will activate the relay switch and any device connected with it for a set time period when any obstacle will come in between the LED and LDR. The circuit is very useful and can be
used for many purposes, for example it can be used to open the light of any room, kitchen, washroom automatically when you go near. The circuit is divided in to three parts. First part is a super bright white LED of 5mm, second part is a very sensitive dark detecting circuit built with two transistors and the third part is a time delay relay circuit built with BC517 darlington transistor.
After building the circuit first adjust the 1K variable resistor to its maximum sensitivity, this can be done in a dark room where the LDR will not get much light. After adjusting the circuit activate the white LED and take it in front of the LDR the relay will immediately switch OFF when the LDR will receive the light. Now adjust again by placing the LED 5 to 10 feet away from the LDR and put the light of the LED on LDR and now adjust the 1K variable resistor until the relay will be deactivated. Also note that in the schematic diagram we have operated the white LED with a separate power supply but you can also operate it with the same power supply of the LDR circuit.
After adjusting the circuit put the circuit in a small plastic box preferably black and make a small hole in the box from which the LDR will receive the white LED light. Also fit the LED part of the circuit in another small box, and place both the boxes in front of each other at a distance of some feet so the LDR will receive the LED light. For example at the entrance door of your room, now if you move from the door the LED beam will be interrupted and the circuit will activate the relay switch. The relay switch ON time is depending on the capacitor Cx, in the diagram we have used a 10uF capacitor which will give few seconds of ON time of the relay. Further increasing the value of the 10uF capacitor will give more ON time. For example a 1000uF will give 5 minutes ON time and a 2200uF will give even more.