Game Instance

Captain Planet teaches us planeteers not to leave the lights on when not used. Or rather when they cannot be seen. For this reason I've devised a simple circuit that breaks the Christmas lights during the day, in a similar manner to the street lights system. This comes in the nick of time as I'll be going to visit my folks this week-end and leave the balcony lights unattended.

Light switch - breadboard setup

The circuit

comprises a voltage divider that has a light-dependent resistor near the GND and a transistor that switches the consumer on and off. In the schematic below, the consumer is a small LED with its current limiting resistor. For bigger consumers the LED can be replaced with a power transistor or a relay.

In a dark environment the photoresistor exhibits a very high resistance, around 1 MOhm but exposed to light, at around 10 lux, that value drops to 2 kOhm. Therefore, when there's no light the voltage available in the base of the transistor is almost half of the one provided as Vcc. In case Vcc is 5 V, the 2.5 volt is enough to open the transistor. At the slightest ray of light, the photoresistor starts pulling the base voltage towards the ground, closing the transistor.

The photoresistor

is the heart of this circuit. It is a compact two-leaded component that varies the resistance with the illumination. Actually the more light it's exposed to, the less resistance it sports. More about it on Wikipedia. There's not much information about its spectrum though but it surely is sensitive to infrared. You can go ahead and test it with any IR remote control.

Photoresistor - a close-up shot

Beware! Some of the photoresistors available on the market contain CdS and CdSe, both toxic substances. If such a component physically breaks, cracks or gets chipped, it will expose the material. If that happens, make sure you gather all the pieces in a sealable bag and dispose it accordingly. Try not to touch the pieces directly and wash your hands after handling them.

Should you go for a relay as a consumer, make sure you use a flyback diode to protect the switching transistor from excessive voltage buildups. When the switch turns the current off, the relay's coil tends to oppose that sudden move. Placing a diode in parallel with the coil but with opposite polarity will alleviate this by creating a path for the coil current to discharge.