O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


 
Buy the book!
Smart Home Hacks
By Gordon Meyer
October 2004
More Info

HACK
#54
Monitor Your Driveway
Use a couple of sensors in your yard to greet you when you get home and alert you to visitors when they pull up to your driveway.
[Discuss (0) | Link to this hack]

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.

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


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.