9.1 Examples


We offer a schematic of a device which detects a certain level of intensity of ambient light, and when that level is detected, it turns on a device connected to mains grid. Data on 9.5 shows that in absence of light resistance of the LDR resistor, NORP12, is R=1MOhm, which makes both base voltage and base current very low, so there is practically no current flowing through transistor. Since there is no current flowing through the coil of the relay it’s other end is in switched off position. When light intensity reaches certain point, resistance of the LDR lowers (at around 10lx resistance is approximately 9kOhm), voltages and current of the base rise, this current flows further through the relay’s coil which connects pins 1 and 3 and this switches on the wanted appliance to the mains.

Slider of the 5kOhm trimmer resistor sets sensitivity of entire circuit. Lower the slider’s position to lower the light level that triggers the appliance on. Greatest sensitivity is reached when trimmer is omitted from the circuit.
There is a possibility to use a photo-diode instead of a LDR (cathode goes up, to + of the battery), or a photo-transistor (collector up).
The device would be turned off when light is absent in case we placed 47kOhm regular resistor instead, and LDR between points A and B.
Each relay has a coil which accords to voltage of the battery. In our case that is 12V.Resistance of the coil is several hundreds of Ohms, and it shouldn’t be lower than 120Ohm. Current rate through the relay should be equal to or greater than needed by the device plugged to mains. If, for example, we were looking at an 1kW electric heater, it’s current is equal to:

I=P/U=1000W/220V=4,5 A.

Any TUN transistor whose maximum current rating is higher than current through relay’s rate, is alright. This value is calculated by dividing battery voltage with relay’s coil resistance.
When we want to employ remote control over some device, it is possible to utilize different technologies, but in some cases cable connection or radio wave control aren’t the most appropriate ones, like the one between the TV and it’s remote controller. Some IR emitting and receiving photo diodes are used specifically in low range transmitters and receivers. Block scheme on 9.6 represents usage of photo diodes between the sound source (hi-fi, radio receiver, TV) and headphones, which removes the need for long cables.
Low frequency signal which is to be carried is marked with uLF. Based on that frequency, IR transmitter modulates the HF voltage, called the carrier. This modulated HF voltage is further sent to emitting diode LD271. Variable light emitted by this diode varies resistance of the receiving diode, and thus the HF signal created using this variations is equal to the modulated signal on the transceivers end. IR receiver is demodulating this signal, which transforms the received HF signal into the original LF signal which is equal to the original sound. This signal is further amplified and brought to headphones.
Using optical components enables safe interfacing of different devices to your home PC. There is a schematic on 9.7 which displays a simple way to interface a random device to the parallel (printer) port of the computer. For simplicity we chose to connect small portable radio receiver supplied using a 9V battery.
Receiver, battery and the interface circuit are connected to the parallel port using the male SUB-D 25 connector. Program which is to control the circuit is easily developed in any programming language. We display a sample program written in Q-Basic, it will turn the receiver in 7am and turn it off in 7:30 am.

REM Wake up program
10 DO
20 LOOP UNTIL TIME$=”07:00:00″
30 OUT &H378, 128
40 SLEEP 900
50 OUT &H378, 0

At 7 o’clock, voltage on pin 9 will turn to +5V, and it will remain that way for the next 900seconds.


A bit more modern operating systems than Windows 95 will have different ways of controlling the parallel port, and there is an extensive knowledge base on the Internet for programming this kind of operation on any operating system. Google is your friend!
Schematic of another interface circuit on 9.8 enables connection of any device plugged to the mains grid to be turned on or off. Control over this device is done in the same fashion as done in previous program.
When, according to the program pin 9 is +5V (logic one), diode will conduct electricity. Light emitted by it switches the triac inside of the optocoupler on. This current flows through the 150Ohm resistor and creates a voltage drop which ignites the triac, which enables current flow from the mains, which powers the device.
Maximum allowed current of the BT136 triac is 4A, which means that maximum allowed power of the device is 990W. It is worth saying that optocouplers should be used only with resistance load devices (light bulbs, heaters…). When connecting inductance load devices like electro motors, transformers and such, it is advised to use the relay interfaces.