Every time, going to work in the morning, we try not to forget to turn off the apartment lights and appliances. Meanwhile, the function can be run machine consisting of three main blocks (Fig. 1): sensors, digital control unit and key. Here’s how it works.

The light from the lamp H1 illuminates the photodiodes B1 to B2 (Fig. 2), causing the transistors V1 and V2 are open and the inputs of the inverters D1.1, D1.2 into a low potential “0”, which is then converted to high “1” output. There are four possible combinations of the state of the photodiodes at the intersection of luminous flux: 1) B1, B2 is opened, 2) V1 — closed V2 — open, 3) B1, B2 — closed, 4) B1 — open B2 — closed. Thus, for each apartment included in the sequence of combinations will be 1, 2, 3, 4, 1, and output— 1, 4, 3, 2, 1. Now you need to “catch” these two sequences of combinations, to transform the sludge in a single pulse and to apply, respectively, to a summing or subtractive input of reversible counter D6.
This task is performed by a digital control device, assembled in logic elements (circuits D1—D7). It works in the following way. For example, in apartment included. A combination of 1, being the source of perceived logical element Z of the (D5.3), the output of which there is the potential of the “0” setting outputs RS-triggered collected on the logical elements 2I-NOT (D3.2, D3.3, D4.1, D4.2) in the zero state.
The combination of the 2 is perceived as a logical element 2I-NOT (D3.1), the output of which there is zero potential that sets the RS-trigger, assembled on the logical elements 2I-NOT (D3.2, D3.3) in “1” state. Combination 3 is skipped.
Combination 4 perceived logical element 3AND-(D5.2), resulting in the counter input “+1” down counter D6 receives a potential of “0” which increases the contents of the counter by 1. But the combination of 4 perceived also the logical element 2I-NOT (D2.4), the output of which appears a “0” setting RS-trigger (D4,1, D4.2) in “1”state.
Combination 1 again perceived logical element 3AND-(D5.3), zero potential from the output which returns the entire device to its original state.
Thus, the device is activated only in the case when one has fully entered the apartment. The contents of reversible counter 6 is incremented by one (in an apartment became another person).
Fig. 1. Functional diagram automatic devices
Fig. 1. Functional diagram of the automatic device:
1 — sensors, 2 — digital control unit, 3 — key.

Fig. 2. Schematic diagram of the automatic
Fig. 2. Schematic diagram of the automatic “before Leaving, extinguish the light!”.
Fig. 3. Schematic diagram of the power supply.
Fig. 3. Schematic diagram of the power supply.
It is easy to see that when the person leaves the apartment, the contents of the reversible counter is reduced by 1.
If the apartment left the last person, the number 7 written in binary code (0111), will be perceived logical element 4I-NOT (D7.1), and the potential “0” is entered to the input key is assembled on the transistor VЗ will close it. When this transistor switch V5 opens, the relay K1 (МКУ48, passport PA4.500.197 P) work, the contacts K1.1, K1.2 open, and the supply of electricity to the apartment will cease.
Kt315g transistors can be replaced by any other series КТ312, KT315, КТ301 and КТ608Б — КТ604, КТ605, КТ606 with any alphabetic index.
Instead МКУ48-you can use relays of a different type with a trigger voltage of 24 V contact system which allows to commutate alternating current with voltage 220 V and power 2—5A.
Photodiode FD-6G is permissible to replace FD-3.
The scheme of the power supply presents PA figure D. the voltage regulator 5 is assembled on the chip D8 and transistor V14.
The transformer T1 is made on the yoke Ш16Х32, Windings I and II contain, respectively, 1200, and 1600 turns of wire sew-1 of 0.15, winding III of 360 turns of PEV-1 0,2, IV — 120 turns of PEV-1 is 0.45.
Details of the device (in addition to relay K1, power supply, and buttons S1) are mounted on the circuit Board (Fig. 4) size 95X75 mm, made of double-sided foil fiberglass 1.5 mm thick. It is placed in any suitable plastic or metal housing.
Fig. 4. Circuit Board of digital control device, with the layout of the parts (M1:1).
Fig. 4. Circuit Board of digital control device, with the layout of the parts (M1:1).
Fig. 5. The key on the chip K155LA3.
Fig. 5. The key on the chip K155LA3.

Fig. 6. Extra lenses
Fig. 6. Extra lenses:
1 — lens, 2 — housing cover 3 to the circuit Board.

Adjust the unit as follows. Checking the correct installation, disconnect the digital inputs of the control circuit from the outputs of the inverters (D1.1, D1.2) and connect the two keys collected on the chip К155ЛАЗ (Fig. 5). With their help, imitate the intersection of luminous flux. Then check the signal flow.
Machine installed inside the apartment near the front door so that the photodiodes were at the height of 65-70 cm from the floor. At the same level, but on the opposite wall, a lamp H1 with the reflector of the flashlight. 5 volts supplied to it from power supply.
Reliability of automatic devices depends on the stability and power of the light flux falling on the photodiodes. Therefore, the lamp with the reflector and the sensors must be rigidly fixed.
To increase the reliability by installing additional collecting lens in front of the photodiodes (Fig. 6).

Recommend to read

    The constructor of this model class SA Maxim Shekhvatov, a schoolboy from the city of Elektrostal (the Moscow region) and the champion of Russia 2001 in two classes of sports rockets SA...
    Sometimes it is difficult to remove on finger tight ring, but much harder — pressed on the shaft bushing or bearing, Not accidentally creating a variety of devices. One of such devices...