Automatic Power Switch Controller: Walk in, Lights on! Walk out, Lights off!
Lot of times we forget to switch off appliances like lights, fans and air conditioners before leaving our house. This leads to considerable wastage of electric power apart from reducing the life of the appliance.
This circuit senses the absence of occupants in a room and automatically shuts off the power to a particular appliance, say, a tube light or fan. It turns on the appliance again when someone enters the room.
The circuit presented here is relatively simple, inexpensive and can be assembled by anyone having some basic knowledge of electronics. Two decade counter CD4017 ICs along with quad op-amp LM324 and some logic gates are wired to count the number of persons coming out. When the numbers are equal, the circuit assumes that there is nobody inside the room and shuts the power off. As long as the numbers differ, the power remains on.
Circuit description:

The image shows the circuit of the automatic room power controller. Two laser diodes and two light dependent resistors are used as sensors at the entry door. This arrangement can be replaced with the combination of IR LEDs and IR sensors or even normal bright LEDs if laser diodes are unavailable. However, laser diodes with pointed directional light give the circuit better sensitivity and range. The sensors can be placed wide apart, which makes the circuit suitable for covering a large area such as a corridor or any other particular portion of a building. Commonly available laser pointers or laser guns can also be used as laser diodes.
To derive the power supply for the circuit, the 230 V, 50 Hz AC mains is stepped down by transformer X1 to deliver a secondary output of 12V-0-12V, 500mA. The transformer output is rectified by a full wave rectifier comprising diodes D15 and D16, filtered by capacitors C10 and C11 and regulated by IC 7809(IC2). Capacitors C8 and C9 bypass the ripples present in the regulated supply. Regulated 9V obtained is used to power the circuit except relay RL1.
Light dependent resistors LDR1 and LDR2 are fitted on one pillar of the door such that one LDR is inside the door and the other outside. Laser diodes ld1 and ld2 are fitted on the opposite pillar –one inside and the other outside –such that the light from the other diode falls directly on the LDR placed on that side. The LDRs are housed in suitable cabinets to protect from ambient light.
When someone passes through the door, the light beams falling on the LDRs from the LEDs are interrupted one after another, making either ic3 or ic4 to count one depending on the direction of movement. Let us see how resistor r4 and ldr1, and resistor r5 and ldr2 from voltage dividers for the 6.8v supply derived from the combination of resistor r3 and zener diode zd1. The divided voltages so obtained are fed to pins 10 and 12, and pins 5 and 3 of ic1, respectively. The resistance of the LDR in bright light is less than 5 kilo ohm, while the resistance in dark is greater than 1 mega ohm. So the voltage at non-inverting pins 10 and 12, and pins 5 and 3 depends on the amount of light falling on the LDRs. Inverting input pins 2,6,9 and 13 are held at a constant voltage of 3.3V derived from the combination of resistor R6 and zener diode ZD2.
Suppose LDR1 is fitted outside the door and LDR2 inside. When anyone enters the room, light on LDR1 is blocked first ( its resistance increases) and pins 10 and 12 of IC1 are at higher potential than its pins 9 and 13. The high output from pins 8 and 14 of IC1 is fed to N1 and N2 respectively. Capacitor C4 connected to N1 charges and retains pin 1 of N1 high for a few seconds before it discharges through resistor R11.
If light on LDR2 is blocked within this time period, pins 5 and 3 of IC1 become high. The high output at pin 7 of operational amplifier A2 is fed to N1, which provides a clock pulse at pin 14 of IC3. Pins 1 and 14 of Ic1 cannot become high together because the high output at pin 14 makes the voltage at pin 2 higher than pin 3 (via diode D3) and pin 1 becomes low. Thus pins 5 and 6 of N2 don’t go high at the same time and IC4 gets no clock pulse when someone enters the room.
When someone comes out of the room LDR2 is blocked first making pins 7 and 1of IC1 high. The high status of pin 1 is retained for a few seconds by capacitor C5 (via diode D4) until it discharges through resistor R12.
If light falling on LDR1 is blocked within this time, pin 14 of operational amplifier A4 becomes high making pins 5 and 6 of N2 high. This gives a clock pulse to pin 14 of IC4 via pin 4 of AND gate N2. However, as pins 8 and 7 of operational amplifiers A1 and A2 cannot become high at the same time, IC3 gets no clock pulse.
Thus when someone enters the room, the output of IC3 advances by one. Similarly, when someone exits the room, the output of IC4 advances by one.
The identical output pins of decade counters IC3 and IC4 (Q0-Q9) are ANDed together via gates N3 through N12 and the gate outputs are connected together via blocking diodes D5 through D14.
With this arrangement, if any two identical outputs of IC3 and IC4 are high, the output of any of AND gates N3-N12 will be high. The high output of the AND gate makes transistor T1 conduct via resistor R16. As a result, transistor T2 cuts off and relay RL1 de-energises to deactivate the appliance connected to it.
Otherwise, transistor T2 conducts getting base current via resistor R18 and the relay energises to switch on the appliance. At the same time, counters IC3 and IC4 reset via capacitor C3. These can also be reset manually by pressing the ‘reset’ switch S1 once.
An actual size, single side PCB for the automatic power controller (fig. 1) is shown in fig. 3 and its component layout in fig. 4. Assemble the circuit on a PCB to minimise time and assemble errors. Carefully assemble the components and double-check for any overlooked error.
Possible modifications:
The circuit can be modified to indicate the number of persons entering and exiting the room. For the purpose, you need to connect LEDs between the ground and the outputs of IC3 and IC4 through 1 kilo ohm resistors.
One limitation of the circuit is that it cannot count more than ten persons in succession. When the eleventh person enters the room (without anyone exiting) the circuit resets. This limitation can be overcome by cascading more decade counters.
Guest Post by Diksha Batra
Category: How To's








i just want to know ,is this circuit turn on appliance when someone enters room?…or it is used just to turn off appliances,what are the modifications should we do to this circuit to turn on appliances when someone enters room?