Simple twilight switch

idea: Elex Team

A twilight switch is an (electronic) switch which turns on a lamp, or such like, when it darkness sets in – with, among other things, the intention of deterring potential burglars by suggesting that someone is at home.

These days you can buy these things for little money from the Far East, but building one yourself is not difficult at all, as the schematic in Figure 1 proves.

Figure 1.

We need, of course, a light sensitive element that will let us know when twilight falls. Here that is LDR R2 (Light Dependent Resistor). Its resistance increases as the amount of light that falls on it decreases. With that the secret of the circuit has actually been revealed: the combination: C1, R1, C2, R2 and P1 form an light-dependent (AC) resistor. The full AC voltage of 230 V appears across this combination. As it becomes darker outside (which, as we have been let to believe, occurs once a day), the resistance of R2 increases, and with that also the voltage at the junction of R1 and C2.

At a given moment (adjustable with P1), the AC voltage at this junction reaches a value of about 30 V, and diac D1 will conduct. As a result, triac Tri1 will receive a trigger pulse and starts to conduct – the lamp will turn on.

Now we have already noted that the entire circuit is connected to the mains voltage; meaning the triac will receive a trigger pulse every half period of the mains voltage, and will block again at the next zero crossing (when the current becomes zero). This whole process repeats itself one hundred times per second (assuning 50 Hz)

We have used a diac here to ensure that the triac receives a well-defined trigger pulse (capacitor C2 lends a hand here by acting as an ‘electron reservoir’ – since once the triac starts to conduct it will act as a short circuit and the voltage across the light-sensitive voltage divider will reduce to zero.


For the third time: the entire circuit is connected to the mains! The construction therefore has to be done with the required amount of care, and keeping in mind all the applicable guidelines. It is best to build it all into a touch-safe, plug type enclosure. In the case of any doubt, show it to an experienced electrician/electronics technician first!