Jump to content
C4 Forums | Control4

Lighting with Motion Sensors


Recommended Posts

I play around with my code to try and achieve the most effective and efficient way for C4 to run my house.

I'm changing a few parts relating to my lighting turning on and off based on motion sensing.

I'm interested to know how you all code this, in particular 'overrides' to prevent lights auto on/off when not wanted.

 

 

 

Link to comment
Share on other sites


Boolean's are definitely very useful here, they are what I currently use also.

 

I'm also interested to know more about the 'when level changes'

This seems like quite an ambiguous function.

 - how many times is it invoked when a light turns off from 100% to 0%?

 - is it guaranteed to trigger at certain light levels during ramping up or down?

      - ie: if I put code in this event to say 'If light is off' do this...  will it be guaranteed to run??

Link to comment
Share on other sites

Since I can't embed jpegs directly, I've attached some of my programming.  In the last Step, if Kit Hold is true (someone has physically turned the light ON), light stays ON.

 

My programming is very similar - in particular the use of variables and using the 'when the variable changes' event to turn the lights on and off.

 

I do have questions:

1. What is the benefit of using the 'when sensor stops sensing motion' vs 'when sensor senses motion'

     - Isn't the time difference between the two generally very short? max a few seconds??

     - I have seen many on here suggest using the 'when stops sensing' but does it really matter?

2. Why use the while loop? I haven't found a need to use 'while' so far.

     - Do you need to trigger this event over and over again while the sensor is sensing motion?

Link to comment
Share on other sites

Answers:

 

1.  Motion is what turns the light ON.  So, lack of motion is what (eventually) turns it OFF.  If you only relied on timer expiration, once that was achieved one of two things can only happen- interlock stops the script or the light goes OFF.  You can't say when timer expires, check for motion because that could be split-second in decision if at the end of the occupancy setting of the sensor.

 

2.  WHILE is necessary to turn the VAR true even if/when the timer expires.  The motion turns the VAR T and expiration of the timer turns the VAR F.  However, WHILE allows the VAR to stay T during sustained motion periods regardless of timer.  If I wrote this to change the VAR without the WHILE, I would be relying only on the "leading-edge" of the motion episode.

Link to comment
Share on other sites

Interesting.

I do rely on time expiring to turn off my lights.

I have the 'when sensor senses motion' reset timer. (not 'start timer') - therefore every time motion is sensed, the timer starts from zero again.

 

I have read people talking of true 'occupancy' sensors - I use the standard PIR that came with my DSC alarm panel - is there a difference with how these react?

 

Or perhaps this is this simply a case of doing the same thing slightly differently.

Link to comment
Share on other sites

^Yes, but if you do that, you loose some flexibility in programming "housekeeping".  Upon expiration of timer there is a state-change of the VAR.  When the state does change, I evaluate if some other flag is high (in my case, a pushbutton) before killing-off the light. 

 

START and RESET do the same thing.

 

CA Motions are more/less designed as an occupancy sensor.  I certainly wouldn't use them as my primary security motion...  I also use DCS motions for controlling stair lighting.  Reaction T might be a tad slower on the DCSs due to the extra layer of comms (serial) the sig must go through.  My beef with CA motions is they are not a dual-tech type of sensor.  Therefore, motion from plants blowing in the breeze will trigger a falsey. 

Link to comment
Share on other sites

START allows you to restart a timer from the point it was stopped, RESET will start it from zero. I assumed therefore that if you START a timer that is already running, it will just keep going, it will not START again. - is this correct? - I have never actually tested it.

 

I find the speed from the DSC sensing to the lights turning on almost instant, I wish they were more sensitive though, they can take a bit of movement to trigger them in certain areas of the house.

 

Controlfouruserguy - Would you please elaborate further on the flexibility I may be losing when using my current approach.

 

Cheers.

Link to comment
Share on other sites

Yes, I also find the DSC's fast but lacking in "sensitivity" in certain areas. I remember my alarm guy telling me to it's possible adjust sensitivity but I did not get details.

 

START allows you to restart a timer from the point it was stopped, RESET will start it from zero. I assumed therefore that if you START a timer that is already running, it will just keep going, it will not START again. - is this correct? - I have never actually tested it.

 

I find the speed from the DSC sensing to the lights turning on almost instant, I wish they were more sensitive though, they can take a bit of movement to trigger them in certain areas of the house.

 

Controlfouruserguy - Would you please elaborate further on the flexibility I may be losing when using my current approach.

 

Cheers.

Link to comment
Share on other sites

^ All I was told is that the standard PIR sensors are the most sensitive they have, as opposed to the alternative of 'Pet' sensors which require more ir beams to be broken to trigger a sense.

(Pet as in cat or dog - used to allow pets to stay indoors without triggering the alarm)

Link to comment
Share on other sites

START allows you to restart a timer from the point it was stopped, RESET will start it from zero. I assumed therefore that if you START a timer that is already running, it will just keep going, it will not START again. - is this correct? - I have never actually tested it.

 

Controlfouruserguy - Would you please elaborate further on the flexibility I may be losing when using my current approach.

 

Cheers.

No, not necessarily correct as far as I have seen and  I've tested all day long on this.  STOP a test timer one second short of expiration and hit START and tell me what happens.  The flexibility I was referring to relates only to programming "housekeeping".  A timer is a timer.  While you certainly can attach programming on the expiration of that timer, I find it is tidier to change a variable state and place my load of code under the TRUE & FALSE legs.

Link to comment
Share on other sites

Yes, I also find the DSC's fast but lacking in "sensitivity" in certain areas. I remember my alarm guy telling me to it's possible adjust sensitivity but I did not get details.

DSC provides a few different lens patterns.  Perhaps you could experiment with others.  I believe I have about 4 different lens styles for the DSC.

Link to comment
Share on other sites

All my lights are done with motion - 

 

On motion I conditionally turn on the lights that I want and start a timer.

When timer motion expires, I kill the light/fan etc.

 

The ONLY negative to this is having to do a "fan run" when you are in a room reading with no motion.  You get used to that.

 

We have several "manual mode" switches for certain rooms that overrides the default timer and gives the user an hour. (Double tap up on the specified switch.)

 

A cool tip that I have taken to is this:

 

Pseudo code follows:

 

On motion

   if the timer is not running

       Start the timer

      Turn on the lights

   If the timer is running then reset the timer only

 

 

The advantage of this is that it will only turn on the lights when you enter the room - if the user then ADJUSTS the lights manually they can and movement will not override that (your wife can manually adjust anything that she wants in the room.

 

If she DOES touch the lights manually then I give her a little more time on the timer because I know that a human is really there and WANTS something specific. Moving in the room will again set the timer and give additional time.  When the timer expires the lights go off and the whole process can start again.

 

Bill

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.