User Tools

Site Tools


Motion Controlled Light

One of the most basic and most useful functions that XTension can serve is to create a simple motion controlled light. Turning on the light for you as you enter an area and turning it off after you leave. This is a very basic tutorial showing how simple the applescript syntax to do this can be, and how far you can customize and complicate matters later if you so desire.

To accomplish this you need three basic elements. A sensor, a transceiver (more on this later) and a module to turn on the light.

The sensor is rather straight forward. I senses motion with in IR sensor that senses changes in temperature. As a warm body walks into a room the sensor “sees” the difference in temperature and activates. This activation sends a coded signal. The coded signal differentiates it from other sensors so that one sensor doesn't turn on all the lights in the house. Each sensor should have an individual address which is done during the setup in the sensor.

The transceiver can be a simple wall plug module that will receive the signal from the sensor and then send it on to the light module.

A more complex transceiver can be used that are rather costly or a computer can be put into the system. The computer has lots of advantages over a simple wall plug transceiver. A good example is that the computer will know that it's daylight and the light does not need to turn on. A wall plug transceiver will just turn on the light.

The computer is called a smart interface since it can be programmed for different scenarios. A good example is the one above but it can also adjust the brightness of a light in the late evening or early morning so that the light doesn't come on to full brightness. Or it can be set to come on to 40% for mood or watching a movie.

The light module can be any number of types. It can be a wired in module, a plug in module, a one way unit, a two way unit and some can even pass on the signal from one unit to another unit further down the circuit. New technology involves wireless transmission of the signal. A two way module will report the status to the smart interface which can be an advantage that will let the smart interface know the light received the command and the change in status has been implemented.

The scripts for activating a light can be none at all to very complex.

One of the easiest scripts would look like this.

turnon "light"

That's it. Once the sensor is activated it sends a signal to the computer. The computer activates the script and sends a signal to the light to turn on.

A more complex script would be like this.

if status of "sunset" is true then
turnon "light"
end if
write log "motion detected in the living room"

This script would only turn on the light IF the sun had set.

Or they can get real complex like this.

if status of "sunset is true and status of "bedtime" is true then
dim "light" to 40
if status of "evening" is true then
dim "light" to 100
end if
end if

This would turn the light on to 40% if a person got up in the night to get a drink or use the bathroom. Otherwise the light would come on to full brightness.

With the smart interface almost anything can be done once the sensor has been activated.

tutorials/motion_controlled_light.txt · Last modified: 2023/02/13 14:52 by