Twilight Sensor

The object of this project is to add a twilight sensor, so that our Home Control System (HCS) can know whether it is dark or light outside. This information can then be used to decide when to open or close curtains and to decide if security lights need to be enabled. Although this is currently linked to our 1-Wire input board, it could equally be used with our our generic optically-isolated input board or any other circuit that using switched voltages.


Kemo M122 twilight sensor
I've looked several ways to achieve this function but, decided to use a pre-built module from Maplin to provide the basic functionality. The module is a Kemo M122 and it is has a low current relay within it.

The unit is mounted on the side of my house under the roof line and is north facing.

It looks like Maplin no longer sell the Kemo M122 module but they do sell a cheaper and similar kit.


The sensor is wired up using burglar alarm wire to a 4-pin PCB connector (Maplin part no. HB58N). This plugs in to our 1-Wire input board but, it could be interfaced to other I/O boards and devices.

The wiring to the pins are:

  • Pin 1 (red) = +12V
  • Pin 2 (black) = 0V
  • Pin 3 (yellow) = Twilight signal (+12V = dark, 0V = light)

The output of the twilight sensor does NOT drive any lighting directly as this would compromise the security of this feed by exposing it to external devices. It would also mean that lighting and other devices connected to this feed are fixed to coming on at dusk and going off at dawn. Typically, devices are required to be activated at dusk but, be switched off well before dawn.


This project is complete and operational and the twilight sensor has been in use for many years now. It has been totally reliable too. We have since moved the sensor over to our USB input board though as this is now being used for all the PIR sensors in our home.


Having your house know if it is dark outside is pretty much essential when intelligently automating much of the lighting in a smart home. With daylight savings time and the changes in the length of a day over the course of the year, it is much better to link automated lighting to the amount of light outside and not just the time of day. We use our twilight sensor to automate our safety lighting and emergency lighting. It is also used for convenience lighting.

  • Using this information to automate actions is much more convincing in making your home look occupied. Initially this might simply be for lighting but future plans could include automated curtains and blinds.
  • In practice, the sensor detects dusk a little later than we would like for control of the lighting in our lounge. To overcome this problem, we average the detected dusk times over the previous three days and switch the lounge lamp on 30 minutes earlier than this average value.
  • Further Reading

    Share ...
    We are on ...
    Facebook Twitter
    YouTube Flickr Follow us on Pinterest