Anda di halaman 1dari 10

Automatic Light Switch for Classrooms

Design Lab Project EPP 301 Project memebers: Manas Paldhe (2008PH10623) Nitin K. Lohar (2008PH10630) Project Supervisor: Prof. M. R. Shenoy

Abstract: Significant amount of electrical energy is wasted when power to an empty room is not switched off. In this project, we first proposed a design for Automatic Light Switch, then fabricated it and successfully demonstrated its working.

Working Principle: Two pairs of low-power toy laser and photodetector are employed to detect whether a power person is entering or leaving a room.

When a person is entering the room, he will first cross the set1 and then he will cross the set2. Similarly when he is leaving the room, he will first cross set2 before crossing set1. The proposed device consists of this direction detector, a counter that stores how many persons are in the room and a logic that checks if the counter value is zero.

Direction Detector


ZeroZero Detector

Each of these logic blocks will now be explained in detail. Direction Detector: The direction detector is a Moore state machine with five states. The initial state is the rest state(0). If detector1 detects first, then the state machine goes into state(1), where it waits state(1), for detector2 signal. Once detector2 goes high, the state machine goes into state(2). From 2 where it goes back into the rest state (state(0)). During state(2), the count up output of the machine goes high. Similarly if detector2 detects first, then the state machine goes into state(5), where it waits for the detecor1 signal. Once detector1 goes high, the state machine goes into state(6).

From where it goes back into the rest state (state(0)). During state(2), the countdown output of the machine goes high.

By making the states quite similar in notation (state(1) and state(5), state(2) and state(6)), the logic has been considerably reduced. The state machine was implemented using 74169 IC. This IC has load and count up/down options. The logic for load and count up is given by the following equations: Load = Q2 Q1 Q0 I2 + Q1 Q0 Count Up = Q2 Q1 Q0 I1 + Q2 Q1 Q0 I2 + Q2 Q1 Q0 I1 The data to be loaded when Load=1 is D2 = Q1 D1 = 0 D0 = Q1 here, denotes the complement. However this machine has a slight problem. If a detector high time is more than the clock time period, then after state(2) the machine will go into state(5) from state(0) (or after state(6) the machine will go into state(1)). Thus, the device will not work properly.

To avoid this, first rising edge (0V to 5V) in the detectors signal is detected. After the rising edge, the output is kept high for a single clock period. Thus, the error is rectified. This mechanism is explained in detail in the following section: Edge Detector: The edge detector is designed using a Moore machine with three states. Initially this machine is in state(0). When the detector signal goes high (5V), then the machine goes into state(1) wherein the output is high (5V). On the next clock edge the machine goes into state(2) in which the output is low (0V). The machine stays in state(2) until the detector signal is high. Once the detector signal goes low, the machine goes into the rest state(0).



Counter: The counter takes in the direction input from the direction detecting module. If a person is entering the room, the count is increased and if a person is leaving, the count is decreased. 74169 counter ICs have been used. Zero-Detector: Zero-detector basically checks if the counter is in state 0000. Thus AND of the counter output is taken. Power = count(0) AND count(1) AND count(2) AND count(3). Light Source and Photodetector: Since a toy laser has high directionality, so it was chosen as the light source. We also tested high directional red and blue LEDs, but over large door widths (~1m), the intensity was almost equal to the ambient light over this distance, so signal could not be detected. Texas Instruments (OPT101) photodetector was used to detect the laser light. This detector has high sensitivity for red light, and also has an inbuilt amplifier. Thus it suits the device requirements. Result: The device is working perfectly. A demonstration video of its working has been uploaded on youtube. (


Figure 1: The designed circuit of the light switch:

Figure 2: The light source and photodetector

Figure 3: Circuit diagram for Load and Counter-up signal.

Figure 4: Circuit Diagram for state machine.

Figure 5: IC 74169

Figure 6: Circuit Diagram for edge detection.

Figure 7: Circuit for counting the number of people. Out1 is LSB and Out4 is MSB. AND of all four outputs will be the input for power.