The Blog of Ian Mercer.

Light sensors for Home Automation

A simple light-dependent resisor (LDR) connected to an Arduino posts regular updates with the light level outside. More sophisticated light sensors are available including ones that give readings on different wavelengths allowing for compensation from UV light. I've tried them but they didn't seem any more useful than the simple LDR for determining how sunny it is outside.

Placing the light sensor is a bit tricky because you want an unobstructed view of outside where there are no house lights that could affect the reading. A single tree in the path of the sun also creates an interesting dip in the graph but generally not enough to affect the determination 'sunny' or 'dark'.

The home automation system uses the external light level to trigger internal lights to come on according to the light state machine. Each light has its own percentage value at which the lights should come on and the level at which they should go off.

This works really well in practice. You can be sitting in the kitchen as a storm rolls in outside and the lights come on just as you notice that it's getting dark inside. In the morning the same lights go off as soon as it's bright enough that they aren't needed. Different lights in the same room can have different percentages set to they come on in a staggered fashion as it gets darker.

Overall I would recommend adding a solar sensor as early as you can if you are creating your own home automation system.

Future plans

I plan on adding at least one more solar sensor to my set up to measure the light in different compass directions and to provide some fault-tolerance.

Snow warning

Recently we had snow on the ground (a rare occurrence in Seattle). It reflected a lot of light up at the solar sensor so it appeared extra sunny outside, however the skylights were covered with snow so those rooms were darker than normal. Even after 15 years I'm still finding edge-case scenarios that the system can't handle perfectly.

Related Stories

Home Automation Sensors

An overview of the many sensors I've experimented with for home automation including my favorite under-floor strain gauge, through all the usual PIR, beam and contact sensors to some more esoteric devices like an 8x8 thermal camera.

Ian Mercer
Ian Mercer

Filtering techniques

Filtering raw data is essential for a reliable home automation system. Here are some of the many ways you can filter sensor data.

Ian Mercer
Ian Mercer

Bluetooth Sensing for Home Automation

Bluetooth sensing for home automation is a great proxy for people counting as it can detect and locate each cellphone in the house. iBeacons attached to tools, cars and pets can provide a 'find my anything' feature too.

Ian Mercer
Ian Mercer

Gas sensors

Gas sensors come in many different flavors including CO2, VOC and particulate sensors.

Ian Mercer
Ian Mercer

Humidity Sensors (DHT11, DHT22, AM2320)

Humidity sensors are great for controlling extractor fans in bathrooms and other damp spaces.

Ian Mercer
Ian Mercer

Microwave Doppler Sensors (RCWL-0516)

Microwave doppler sensors can be found in some alarm sensors but there are also available very cheaply as a separate component. They offer exceptional range but suffer from false triggers requiring a probailistic approach to people sensing.

Ian Mercer
Ian Mercer

Optical-beam sensors

Optical-beam sensors are reliable and can cover a long-distance such as across a garage or aisle-way. When they include multiple-beams they have good false-trigger rejection.

Ian Mercer
Ian Mercer

PIR Sensors for Home Automation

PIR sensors are cheap and easy to use but they suffer from slow response times and low repeat rates.

Ian Mercer
Ian Mercer

Strain-gauges

Strain-gauges are my top-rated sensor for home automation because they are invisible, reliable and can be tuned to detect people and ignore pets.

Ian Mercer
Ian Mercer

Temperature sensors for home automation

Temperature sensors I've experimented with for home automation.

Ian Mercer
Ian Mercer

Probabilistic Home Automation

A probabilistic approach to home automation models the probability that each room is occupied and how many people are in that room.

Ian Mercer
Ian Mercer

Multiple hypothesis tracking

A statistical approach to understanding which rooms are occupied in a smart house

Ian Mercer
Ian Mercer

A state machine for lighting control

An if-this-then-that style rules machine is insufficient for lighting control. This state machine accomplishes 90% of the correct behavior for a light that is controlled automatically and manually in a home automation system.

Ian Mercer
Ian Mercer

The Grideye 8x8 camera sensor

Experiments with an 8x8 IR camera for privacy-preserving people detection using cameras.

Ian Mercer
Ian Mercer

CCTV Cameras as Home Automation Sensors

CCTV cameras are an option for detecting people but within the home there are privacy concerns that need to be addressed.

Ian Mercer
Ian Mercer

Pressure Sensors for Home Automation

Pressure sensors can detect HVAC system operation and could potentially detect clogged filters.

Ian Mercer
Ian Mercer