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.

Design

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.

Wiring

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.

Status

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.

Conclusions

The additional of a twilight (dusk / dawn) sensor to our smart home was made very early on and it has been running reliably since early 2010. Having your house know if it is dark outside is pretty much essential when intelligently automating much of the lighting in your 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.

Our Home Control System (HCS) software receives events when the sensor state changes and we call these events 'dawn' and dusk'. Because light levels vary, it is possible that the sensor will generate more than one dusk or dawn event in each day. A simple software algorithm is used to filter out these unwanted events. We use the first dusk event after 2pm and the first dawn event before 10am. Both dusk and dawn events are equally useful and used by our Home Control System (HCS).

We also calculate 'sunrise' and 'sunset' times (based on time of year and location) and use a combination of this and the dusk/dawn events to drive scenes and actions in our smart home. If we were to simply use calculated sunset time to switch on safety lighting, then it would not handle the variations in lighting levels caused by local weather conditions. We use the first event (sunset or dusk) to turn on lights. Similarly, we the first occurrence of dawn or sunrise to turn lights off.

You could implement this with a dedicated, networked sensor but this is overkill, when a simply binary, wired sensor works so well.

Updates

July 2014

Moved sensor
We had our soffits and gutters replaced, so we took the opportunity to use the scaffolding in place to inspect and move the sensor.

Further Reading

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