Jump to content
C4 Forums | Control4

Lighting with Motion Sensor


Tim

Recommended Posts

I read the posting on advanced program techniques that were presented at CEDIA (here is the posting: http://www.c4forums.com/viewtopic.php?id=2346). One application that it mentioned (number 10) was the control of a room's lights leveraging the motion sensor. This is a great solution for my garage. So, I did implement the program using my Composer HE. It works great. However, I do have one small issue that I am hoping someone can help me with.

Once the light has been activated, and the timer is running, if you leave the garage and push the switch to off, the light turns off, but it will turn back on due to the motion sensor seeing your movement. Besides not touching the switch and letting the timer expire, is there a best practice to manage the light switch being manually turned off with the motion sensor looking to turn the lights on?

I know there are many ways to probably approach this task. To help, my scipt looks exactly like the one posted. The only change I made was adding a conditional statement to have the garage motion only activate the lights when the time set to night time.

Thanks for any help.

Link to comment
Share on other sites


I haven't actually tried this, but thinking through what you describe a couple of things come to mind.

First, you could have another timer which begins when you press the off button. That timer could be 30 seconds or so, and the motion sensor timer could be programmed to first check the status of the off button timer before it turns on the lights.

Thus, for the switch, you'd have:

When bottom button is pressed, begin timer "Press_Off" for 30 seconds.

Then under the motion sensor:

When motion is detected, if timer "Press_Off" is off, turn on lights and start or reset timer "Motion_Lights" for xx minutes

When "Motion_Lights" expires, turn off the lights.

Note that I'm not actually sure whether the motion detector can check the status of the timer (I think it can) but if not you could always just use "Press_Off" to toggle a variable.

The net effect of all this is that the motion detector will not turn on the lights within 30 seconds of you pressing the off button.

Note that I'd make the pressing of the off button the triggering event for the Press_Off timer, rather than the light going off. If you were to make the light going off the triggering event then anytime you didn't pass in front of the motion detector and the lights went off on their own, you'd need to wait 30 seconds before your waving arms could turn it back on.

Would this do what you're looking to do?

--Jason

Link to comment
Share on other sites

The solution by Jason is exactly the way I would propose you do it. A second timer that's triggered on the 'off' press. Then it's only a single conditional in your first script, so if the 'off timer' is running, then don't run the rest of the motion script.

RyanE

Link to comment
Share on other sites

Jason and Ryan,

Thanks for your suggestion and feedback. I implemented the change last night and tested it. It worked great.

I have attached a document for those who may want to see the program or who are trying the same thing and would like an example.

Tim

Link to comment
Share on other sites

  • 2 weeks later...

With the code the way you have it I think the lights stay on for 10 minutes every time you leave the garage without hitting the off button. Is there a way to make it more energy efficient, such as having the motion detector only reset the timer if motion is detected within the last minute of the occupancy timer?

If motion detector senses motion

Check occupancy timer

If timer greater than 1 min remaining --> Do nothing

If timer less than 1 min remaining --> Reset timer

This way, if you leave the garage 8 minutes after entering then the lights will turn off 2 min later. Of course, it requires movement within that 1 min period at the end to keep the lights on, but if they accidentally turn off you could always swing your arm to turn them back on. The upside is saving some energy whenever you leave without hitting the off button (ie, leaving by car).

Link to comment
Share on other sites

The upside is saving some energy whenever you leave without hitting the off button (ie, leaving by car).

That, and your 'waving arm' gets a lot of exercise.

I have mine set to turn off after 10 minutes of no activity, and for my office, I'm still waving my arm quite a bit.

I would think a lot of how long to make the shutoff time has to do with how much activity you have in the area, and where the motion detector is located.

In a garage, if you don't have a chair in there, 1 minute is probably enough.

RyanE

Link to comment
Share on other sites

With the code the way you have it I think the lights stay on for 10 minutes every time you leave the garage without hitting the off button. Is there a way to make it more energy efficient, such as having the motion detector only reset the timer if motion is detected within the last minute of the occupancy timer?

If motion detector senses motion

Check occupancy timer

If timer greater than 1 min remaining --> Do nothing

If timer less than 1 min remaining --> Reset timer

This way, if you leave the garage 8 minutes after entering then the lights will turn off 2 min later. Of course, it requires movement within that 1 min period at the end to keep the lights on, but if they accidentally turn off you could always swing your arm to turn them back on. The upside is saving some energy whenever you leave without hitting the off button (ie, leaving by car).

Personally, I think balancing convenience with energy savings has the advantage of not making us secretly curse the things we're doing for energy efficiency :D For example, most people hate the annoying faucets that you press the knob and get 3 seconds of flow from, so you ahve to press it 10 times to wash your hands. Now that more places seem to use the IR beams, it's a lot easier for people to behave in an eco-friendly way.

In this case, I'd be inclined to leave it a bit longer so that, for example, it's not shutting off every time you carry a bag of groceries into the house and you have to wave your arms to get them back on. Instead, switch the lights to compact fluorescent, leave it a bit longer, and kow that you're still saving tons of energy, especially when you consider that a single night leaving them on accidentally would consume more than an entire year of 10 minutes versus 2.

To put it in perspective, wasting 8 minutes of juice with twice a day with 4 CFL bulbs will consume the same electricity your fridge uses in <3 hours.

((21 watts) x (8 minutes) x 2 x 365) divided by (700 watts) = 2.92 hours

I love that Google can evaluate the equasion above . . .

--Jason

Link to comment
Share on other sites

Yeah its definitely a balance between being annoyed and being conscientious, but the way I look at it is:

How often am I in the garage for that long at night, and under that limitation how often do I think I would end up not moving for 1 minute such that the lights go off and I have to do something to correct that?

Chances are, not much, for me at least...

Remember, the way I wrote it the lights wouldnt turn off 1 minute after it doesnt detect motion, they would be on for a minimum of 10 minutes first, then reset for another 10 minutes. The difference is just that if you leave at some point in the first 9 minutes then there isnt *always* 10 minutes of unused lighting.

I agree with you on CFLs though... Im planning on outfitting as much of the house as possible with them once its built. I looked into solar but its changing too fast and still too pricey to make it worth it...

Link to comment
Share on other sites

Neil and Codeman,

Great eyes..... It is a HALO theme. I use the HALO 2 WindowsBlinds theme with a HALO 3 background. My son loves the XBOX game. I set it up so he would get a kick out of it when he uses my laptop for school work. I have attached a bitmap so you could see the whole desktop.

On turning the light off before the motion sensor timer expires, I looked into this one. Fortunately for this application the switch for the overheads is directly beside the house entry door. So, turning off the lights with the 30 second delay when entering the house seems to be okay. One other option is to leverage an alarm button on the house entry door. I thought about looking to see if the door was shut with no motion in the garage. I would then stop the timer and turn the lights off. I haven't tried this approached to see if it works better.

Tim

Link to comment
Share on other sites

Just courious . . .Why are you using a Motion Detector and not a Occupancy Sensor. We usually install Motion Detectors where there is foot traffic . .ie a walkway, hallway, etc. In an area where there will be actual occupancy such as a Garage, Laundry Room, etc we will install an Occupancy Sensor. An Occupancy Sensor much more accurate and reliable than a Motion Detector.

Just wondering

Link to comment
Share on other sites

For this install, I leveraged what was already established in the house. In the garage there was a motion sensor for the alarm system. I agree that an occupancy sensor would be more accurate. But, this seems to be working fairly well. It catches the garage door activity as well as any other night time movement. For power effiencey, the best route would have been the CardAccess Garage Automation system. This would support the primary goal to turn on the lights in the garage and house when coming home at night.

Tim

Link to comment
Share on other sites

For this install, I leveraged what was already established in the house. In the garage there was a motion sensor for the alarm system. I agree that an occupancy sensor would be more accurate. But, this seems to be working fairly well. It catches the garage door activity as well as any other night time movement. For power effiencey, the best route would have been the CardAccess Garage Automation system. This would support the primary goal to turn on the lights in the garage and house when coming home at night.

Tim

I did the same in my house - i have a alarm motion detector in the front area; if its nighttime and it detects motion, the stair lights come on for a couple minutes. of course if it detects motion when alarmed, it does all the other alarm stuff too

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...