This useful circuit is built around well-known timer IC TLC555. It activates an electric bulb when your PC is switched ‘on’. When you shut down the PC, the lamp also automatically turns ‘off.’
To avoid the possibility of electromagnetic radiation, use of a step-down transformer has been done away with intentionally in the power section of the circuit. Instead, a capacitive potential divider is used to reduce the supply voltage before feeding it to the rectifier circuit, which gives the required working voltage of 5V DC for the control circuit. Capacitor C5 is the main element in this configuration. When PC is ‘off’ and even with AC mains supply available, output pin 3 of IC2 is low and hence TRIAC1 doesn’t conduct.
Optocoupler IC1 is used here to isolate the PC from the control circuit of the table lamp. Capacitor C1 bypasses any variations on the USB port. Resistor R1 limits the input current.
When the PC is switched ‘on,’ 5V DC from the USB port is applied to optocoupler MCT2E (IC1), and it conducts. This pulls down the input to pins 2 and 6 of IC2. Consequently, the output of IC2 goes high and TRIAC1 is fired through R3 and diode D4. This completes the supply to lamp L1 and it lights up.
As soon as the PC is switched off, the input to the optocoupler cuts off and the control circuit stops functioning as input pins 2 and 6 of the timer IC go high and output pin 3 goes low. The lamp turns off.
Assemble the circuit on a general-purpose PCB, connect the input point of the device to a vacant USB port of the PC using a standard USB cable, with an A-type connector on one end and a B-type connector on the other end. Note that only 5V DC supply from the USB port is used here for the PC-status detection. Power input for the device is 230V AC reduced by C5-R5 combination and rectified by diodes D2 and D3. The device is very small and therefore it can be easily fitted inside a fancy table lamp unit.