This hack provides a simple but effective method for detecting and reacting to cars that enter and leave your driveway. It can do the following things for you:
As you drive away from the house, your home automation system can light the driveway and then turn off the lights a few minutes after you're gone.
When you arrive home, it can light the driveway and begin getting the house ready for your arrival (e.g., by turning on lights, adjusting the thermostat, and so on).
If you're at home and a car enters the driveway, your house can alert you to the arrival of a visitor.
Once you have the system in place, you'll think of other things you can trigger based on knowing that someone is leaving or arriving. Let's begin by discussing the sensors that make all this possible.
The Sensors
I use two X10 PR511 Motion Detector Floodlights (http://www.smarthome.com/4080.HTML; $50) to monitor and light the area in front of my garage and the area where my driveway meets the street. These devices have two floodlights and a passive infrared motion detector integrated into one unit, as shown in .
Figure 1. X10 Motion Detector Floodlights
You can set these units so that they will turn on the floodlights automatically when they sense movement at night, or you can control them with X10 commands. For the purposes of this hack, let's set the unit so that, in addition to turning on the floodlights when motion is detected, it sends an On command to another address.
To set the address that the PR511 sends to when activated, first you must set its base address . Let's say you set it to B1. Next, you use the switches inside the unit to set Address +1 to In. Now, whenever motion is detected, the floodlights turn on and B2 On is sent to the power line. After a time delay that you've configured has expired, the unit sends B2 Off. Refer to the PR511's manual for details .
Set the second PR511 unit to send its command to a different address, such as B8.
Positioning the Sensors
Place one PR511 near the entry to the driveway, but far enough so that it won't be tripped by a bicycle on the sidewalk or a car that is just turning around. You might even aim it away from the street, back toward the house, but angled so that it monitors only the driveway area.
Place the other PR511 near the garage so that it is activated only when motion occurs within about 10 feet of the garage door, or approximately where you stop the car to open the garage door.
When you position the sensors, keep in mind that they can be falsely triggered by areas that reflect a lot of heat during the day or by trees that sway in the breeze.
TIP
See "Sense What's Happening" for more information about how motion detectors work.
You can adjust the detectors' sensitivity using the controls in the PR511, which is probably necessary for most situations.
Reacting to the Sensors
The sensor by your garage sensor automatically turns on the floodlights if someone leaves or approaches the house after dark. It also sends a B2 On command to indicate that it has been triggered. The B2 unit is called Front Drive Motion in XTension , and here is its On script:
if time delta of "Front Walk Motion" is less than 30 then
turn off "Driveway Lights" in 20
else
turn on "Foyer Chime"
turn on "Driveway Floods" for 2 * minutes
write log "Someone entering driveway"
end if
The time delta function is used to determine if the sensor by the driveway's entrance, Front Walk Motion, has been activated within the last 30 seconds. If it has, an event to turn off Driveway Lights is scheduled. These architectural lights line the driveway. Otherwise, an indoor chime module is activated to alert anyone who's at home, and the lights are scheduled to turn off two minutes later.
Here's the Off script for Front Drive Motion:
if status of "Front Drive Motion" is false then
if time delta of "Front Walk Motion" is less than 30 then
turn off "Driveway Lights" in 20
else
turn on "Foyer Chime"
turn on "Driveway Floods" for 2 * minutes
write log "Someone entering driveway - missed the ON"
end if
end if
The Off command indicates that the motion detector has reset itself after detecting motion. First this script checks to see if the unit is already turned on in XTension. If it's not, that means the On command was missed, due to line noise or a signal collision, so the actions to alert the house are repeated here. As a rule, it's a good idea to have scripts for motion detectors check to make sure an On event wasn't missed and, if it was, perform at least some of the tasks that should have been done.
Now, let's talk about the sensor installed at the driveway's entrance, near the sidewalk in front of the house: Front Walk Motion. Again, the floodlights on the sensor are not explicitly controlled; the PR511 turns those on and off automatically. The On script for Front Walk Motion does most of the work:
turn on "Front Walk Light"
if time delta of "Front Drive Motion" is greater than 30 then
turn on "Foyer Chime"
write log "Movement on the front walkway"
end if
Here's the unit's Off script:
if status of "Front Walk Motion" = false then
turn on "Front Walk Light"
if time delta of "Front Drive Motion" is greater than 30 then
turn on "Foyer Chime"
write log "Movement on front walk, missed the ON"
else
write log "Someone has arrived, missed the ON"
end if
end if
The important point to notice here is that the status of the sensor in front of the garage, Front Drive Motion, is used to decide if someone is arriving or leaving. If a person is leaving, the chime module is not activated because there's no need to alert the house's occupants to this. You'll need to adjust the time delta value so that it works for the typical length of time it takes to drive between the two sensors. Don't expect it to be perfect, though; even humans sometimes have a hard time figuring out if they're coming or going!
Hacking the Hack
If you don't want to turn on floodlights when motion is detected because it might disturb the neighbors, or if you just want a subtler response, you can remove the bulbs from the PR511 units. Or, use a photoelectric beam sensor instead (http://www.rpelectronics.com/English/Content/Items/E-960-D290.asp; $170), as shown in .
Figure 2. A photoelectric beam sensor
Although much more expensive than the PR511, photoelectric sensors are more reliable and less subject to false alarms. They work by projecting an invisible laser beam across your driveway to a reflective sensor. When an entering car breaks the beam, a relay is triggered. Connect the unit's relay to a Powerflash module so that an X10 command is sent to your home automation system. The price for these sensors varies based on their effective range, so, depending upon your property, you can get a long-range sensor to cover more than just your driveway, or a shorter sensor for less money.
Finally, note that the action programmed here (turning on a chime module) is just the beginning. If your house knows who is at home, it can send you an email that someone is on your property and immediately start turning on lights to make the house look occupied in case the visitor has bad intentions. If you've implemented a system to control your garage door you can use that to open or close the door based on the time of day and whether it's likely to be you that's arriving or leaving.
As with most things in home automation, once the basics are in place, you can take your system in new directions by knitting together pieces with new logic and thinking.
—Michael Ferguson