Light activated by a motion detector

123

Senior Member
You need two things to make this work:
  1. a motion detector
  2. a light controlled by the M1 via PLC (X10, Insteon, Zwave)
The following three rules work together to create a motion-controlled light.

WHENEVER MotionDetector (Zn 5) BECOMES NOT SECURE
THEN TURN LightTimer (Out 64) ON FOR 1 RESTART TIMER IF RUNNING
WHENEVER LightTimer (Out 64) STATE IS TURNED ON
THEN TURN RoomLight [1 (A1)] ON
WHENEVER LightTimer (Out 64) STATE IS TURNED OFF
THEN TURN RoomLight [1 (A1)] OFF

The example uses the following M1 resources (change them to match your environment).
Zone 5: MotionDetector
Output 64: LightTimer
A1: RoomLight (X10 protocol)

How It Works
Whenever the motion detector sees movement it restarts a one-minute timer. When the timer is activated the first time, the light is also turned on. When the timer expires, the light is turned off.

To reduce PLC traffic on the powerline, the "ON" command is issued only once when the timer is initially activated. No other PLC commands are generated until the timer expires and an "OFF" command is issued.

Everytime there is movement in the room, the one minute timer is restarted and the light remains on. If there is no movement detected for one minute, the timer expires and the light is turned off. Please adjust the timer's period to suit your needs.
 
If I had the choice I would prefer to use an occupancy sensor over a motion detector for lighting control. Now if I could only find a smoke detector with built-in occupancy sensing.
 
... I would prefer to use an occupancy sensor over a motion detector ...

I never heard of an occupancy sensor, and why it would be superior to a motion detector, so I googled it. According to several definitions, an occupancy sensor is the combination of:
  1. motion sensor
  2. control circuitry
  3. controllable light
http://www.greenseal.org/resources/reports/CGR=Sensors.pdf
http://www.greenguardian.com/eppg/10_6.asp

SmartHome sells an occupancy sensor and it embodies the aforementioned definition: http://www.smarthome.com/2522W.html
So the combination of a motion detector, PLC-driven light, and the Rules I posted (a.k.a. "control circuitry") constitutes an "occupancy sensor". I always called it a "motion-activated light switch" but "occupancy sensor" is more compact!

Atmel makes a chip for occupancy sensors that includes features that I'd like to add to my "occupancy sensor":
  1. Turn on the light only if the room is dark.
  2. Warn the occupants the light will be turned off, in one minute, by flashing the controlled light or providing an audible warning.
Their chip also records room usage and adjusts itself based on past history. That's a great feature but beyond the M1's programming capabilities and best served by Home Automation software.
 
I think the biggest difference is trigger programming. A motion sensor is programmed to minimize the chance of a false alarm by requiring multiple steps, having pet immune lenses, etc. An occuupancy sensor is designed to minimize reaction time or accidently shutting off too soon and leaving you in the dark. An occupancy sensor will generally trigger quickly and will reset its timer based on very small movements.

If you used an occupancy sensor for security you would get a lot of false alarms. If you use a security sensor for occupancy you will get sluggish triggering of your lights.
 
An occupancy sensor with relays and timers built-in are what I'm referring to. The occupancy sensor will trip the automation panel, then the panel triggers a rule to turn on lights. You can manually set the timer on the occupancy sensor for 30 secs, 10 minutes, etc. so that the light will stay on as long as the relay is open.

Check out this link for a comparison of an occupancy sensor and security motion detector.
 
Mike,

Thanks for the clear definition! So basically both devices detect motion but use different criteria to create an event.

I guess my old DSC sensor, located in my largely unoccupied basement, qualifies as an "occupancy sensor" because it detects minor movements (tip your head or move your arm and it lights up). I guess a modern "motion sensor" would not activate under the same conditions. It would overlook small movements, allow the timer to expire, and turn the light off while the room was occupied.

OK folks, so the performance of the "motion-acitvated light" I've described will vary according to the performance of the motion/occupancy detector you use.
 
An occupancy sensor with relays and timers built-in are what I'm referring to. The occupancy sensor will trip the automation panel, then the panel triggers a rule to turn on lights. You can manually set the timer on the occupancy sensor for 30 secs, 10 minutes, etc. so that the light will stay on as long as the relay is open.

Check out this link for a comparison of an occupancy sensor and security motion detector.

Ok, thanks for the link. Clearly there's more than one way to turn on a light ... from SmartHome's $20 self-contained switch to an M1 with sensors, rules, and PLC-based lights.

My goal was to squeeze one more use out of an existing motion detector. The rules are simple and the whole thing works well for me. I can change the timer period within the rule or assign it a Custom Value so it can be modified from a keypad. With a few more rules, and an occupancy sensor, it can become more flexible and reliable. I was hoping this simple example would inspire other people to experiment and post their results.
 
There is no difference!

If you buy a motion detector with a 1 pulse/3 pulse selector... 1 pulse would be used for your "Occupancy" situations and 3 pulses for "Security" situations.


IT IS STILL A MOTION DETECTOR IN EITHER CASE! Some are better at one than the other, but that does not change what they are...

:wacko:

Vaughn
 
One catch with the above rules are that they don't allow for manual override. For instance when there is little movement but you want the light on -- when watching tv, etc.

One that has plagued me is having a motion sensor turn on the lights on at a dimmed setting when someone enters certain rooms after dark. The problem is that they turn off when I want to stay in the room, but there isn't much movement. Haha, it sounds like I am describing a bathroom, which would be nice as well, but it's actually a family room.
 
One catch with the above rules are that they don't allow for manual override. For instance when there is little movement but you want the light on -- when watching tv, etc.

One that has plagued me is having a motion sensor turn on the lights on at a dimmed setting when someone enters certain rooms after dark. The problem is that they turn off when I want to stay in the room, but there isn't much movement. Haha, it sounds like I am describing a bathroom, which would be nice as well, but it's actually a family room.

The way I plan to do manual override is to have the actual light switch trigger an appliance module which in turn operates a relay that shorts across the motion sensor zone. If the light is turned on manually the relay prevents the motion sensor from turning it off. When the switch is turned off manually, the relay opens and the light is once again controlled by the motion sensor. (Obviously the relay is not triggered by the motion sensor or this would not work).
 
Probably a repeat of what you had discussed, but I had found a great example of motion control for a Z-wave light (could be any other lighting protocol) from David Powell. http://www.doityourself.com/stry/how-to-au...ur-laundry-room

Very interesting in the section on how you can use "virtual outputs" as a timer. A "virtual output" being an output that is not connected. Read the article, as he states the information better. You could create a rule set that does the same method, but have it flash the light, perform the output timer again and then shutoff. This would provide the individual in the room the opportunity to wave a hand or foot to trigger the motion.
 
Very interesting in the section on how you can use "virtual outputs" as a timer. A "virtual output" being an output that is not connected. Read the article, as he states the information better. You could create a rule set that does the same method, but have it flash the light, perform the output timer again and then shutoff. This would provide the individual in the room the opportunity to wave a hand or foot to trigger the motion.
Yes, phantom outputs are the commonly used way of doing timers within the M1. In fact that's exactly what the OP did as well in this line:

THEN TURN LightTimer (Out 64) ON FOR 1 RESTART TIMER IF RUNNING
 
Probably a repeat of what you had discussed, but I had found a great example of motion control for a Z-wave light (could be any other lighting protocol) from David Powell. http://www.doityourself.com/stry/how-to-au...ur-laundry-room
...

It was David Powell's article that inspired me to improve upon his first rule:
WHENEVER Laundry Motion [Zn1] BECOMES NOT SECURE THEN TURN Laundry Room [1 (A1)] ON, FADE RATE = 0

This rule generates PLC traffic (i.e. an ON command) each time the motion detector (Zn1) is activated. My version minimizes PLC traffic by having the motion detector restart a timer whenever it sees movement. A second rule issues the ON command only when the timer is first turned on.

I like Johnnynine and Upstatemike's idea of providing a manual override. Yes, it defeats the purpose of ensuring the light turns off automatically but, hey, what're you gonna do?

Ideal Scenario:
  • The light turns on automatically when there's movement and remains on while it continues to detect movement.
  • If there is no movement detected for a period of X minutes, the light flashes to indicate it will turn off in one minute.
  • You get off the couch and activate the switch manually. The light remains on, overrides the motion-detecting/automatic off feature, and remains on until you turn it off.
I believe Upstatemike's idea can be accomplished using rules and a counter and most important of all, using a 2-way switch (i.e. transmits its status whenever it is activated/deactivated). When you turn on the light manually, a rule sets a counter to 1. An AND clause is appended to the third rule in my example:
WHENEVER LightTimer (Out 64) STATE IS TURNED OFF
AND COUNTER 1 IS 0 (not sure if this is the correct syntax; I don't have access to RP at this very moment)
THEN TURN RoomLight [1 (A1)] OFF

So if the counter is 1, RoomLight is not turned off and the timer expires without action. Another rule is needed to set the counter back to 0 when the light is manually turned off.

I'll tinker with the rules and see what I can do; thanks for your great ideas!
 
You might be able to do it with a rule. When I came up with my solution I was not planning to use the M1 but rather a motion sensor connected to a dry contact Insteon transmitter. As for the flashing to warn you to get up and reactivate the lights... that would not fly in my house. Instead I will just have the override go back to motion mode at midnight, 3AM, and dawn.
 
... I will just have the override go back to motion mode at midnight, 3AM, and dawn.

A schedule-driven override! I like that!

All of these ideas would be much easier to implement using MisterHouse or some other Home Automation application (CQC, Homeseer, etc). I've become accustomed to MisterHouse's Perl-based, object-oriented architecture. The M1's rules, counters, and timers are simple and efficient .. perhaps too simple when used to solve complex problems. However, mustangcoupe's Irrigation Rule proves that a little creativity goes a long way.
 
Back
Top