Many a times we forget to switch off appliances like lights, fans and air-conditioner before leaving home. This leads to a considerable wastage of electricity apart from reducing the life of the appliances.
Here is a circuit that solves this problem by sensing the absence of occupants in a room and automatically shutting the power ‘off’. It turns on the power again when someone enters the room. The same circuit can be used for a particular appliance also, say, air- conditioner.
The circuit presented here is a microcontroller-based automatic room light controller. The microcontroller along with op-amp LM324 is wired with two IR sensor units to count the number of persons going inside and number of persons coming out. When the number of persons inside room is zero, it automatically disconnects the power. When someone enters the room, the counter increments and the power to the room is restored. The number of persons inside the room is displayed on a seven-segment display.

Circuit Description
The block diagram of the presence sensing lights controller is shown in Fig. 1 and the circuit in Fig. 2. To derive the power supply for the circuit, the 230V, 50 Hz AC mains is stepped down by transformer X1 to deliver a secondary output of 12V, 500 mA. The transformer output is rectified by a full-wave rectifier comprising diodes D1 through D4, filtered by capacitor C1 and regulated by IC 7805 (IC1). Capacitor C2 bypasses the ripples present in the regulated supply. Regulated 5V is used to power the receivers are to be mounted on the opposite frames of the door such that light from the infrared transmitter falls directly on the detector on the side (refer Fig. 1). Cover the infrared receivers with a mask to protect these from ambient lights.

Infrared signals from IR TX1 and IR TX2 continuously fall on IR RX1 and IR RX2, respectively. The signals detected by RX1 and RX2 are fed to inverting input pins 2 and 6 of comparators N1 and N2, respectively.
Normally, the comparators at pins 1 and 7 are high which are given to microcontroller port pins P2.0 and P2.1, respectively. When someone passes through the door, the infrared beams are interrupted and the comparator outputs go low. Microcontroller AT89C51 increments/decrements the count depending on the direction of movement.
Microcontrollers AT89C51 is the heart of the automatic room light controller. It is an 8-bit microcontroller with 4 kB of flash programmable and erasable read-only memory (PEROM), 128 byte of RAM, 32 input/output (I/O) lines, two 16-bit timers/counters, and a five-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator and clock circuitry. Power-on-reset is provided by the combination of resistor R6 and capacitor C3. Switch S1 is used for manual reset.
A 12MHz crystal along with two 33pF capacitors provides the basic clock frequency to microcontroller AT89C51. Three seven-segment displays (DIS1 through DIS3) are interfaced with the microcontroller through Port 0, Port 1 and Port 3, which are used to display the number of persons inside the room. Port 0 is pulled high with resistor network RNW1. Port pin P2.7 drives relay RL1 to control the power.
When somebody enters the room, the comparator outputs go low and port pin P2.7 goes high. Transistor T1 drives into saturation to energize relay RL1. Diode D5 acts as a free-wheeling diode. Resistors R9 through R32 are used to limit the current through segments of the 7-segment display. Presets VR1 and VR2 are used to set the threshold voltage of comparators N1 and N2, respectively.

for Contact email me

Microcontroller Contest

Participated in the
Microcontroller Contest

Build My Lab Contest

Participated in the
Build My Lab Contest

Be the First to Share


    • Paint Challenge

      Paint Challenge
    • Hide It Challenge

      Hide It Challenge
    • Unusual Uses Contest

      Unusual Uses Contest


    Thank you for publishing the rest of your Instructable. That's the spirit !!!! Cheers !!!


    8 years ago on Introduction

    sorry guyzzzzzz........
    im juzt nw....
    in this
    right now im going to publish it....
    sorry ....................

    "FOR parts list and source code
    VOTE FOR my PROJECT !!!!!!!!!"------- not in the spirit of this website !!!!!!!