Driveway Intruder Alert With LinkIt One
by AndrewV2 in Circuits > Sensors
5872 Views, 125 Favorites, 0 Comments
Driveway Intruder Alert With LinkIt One
Ever want to know when someone is driving into your driveway? Well I always have. Especially when someone is coming to pick up one of my kids to take them to school, or the dance, or another event. And since it's a waste of time to sit by the window and look for headlights coming down the driveway, I figured it's about time I installed an infrared detector at the entrance which is controlled by the versatile LinkIt One microcontroller. Now, we get a distinctive BEEP BEEP pattern when someone is coming. And I can yell "Junior, your ride is here" without even looking up from my paper at the dinner table.
So let's get started. All you need is a few devices and you'll be off and running.
Gather Devices
For this Instructable you'll need the following items:
1. LinkIt One Microcontroller Developer Board. [This baby has the works, GSM/GPS, Wi-Fi, Audio, etc -- also for future applications]
2. Parallax passive infra-red (p.i.r.) sensor (model # 555-28027 Rev B). This detects objects in about 15 feet (can range to 30) by sensing motion via changes in heat signatures.
3. Waterproof housing to contain the p.i.r. sensor and keep it away from the elements.
4. A piezo buzzer which will sound the alarm when a car enters the driveway.
5. A toggle switch that turns on the 'Intruder Alert'. Mine is easily accessed in the garage next to the LinkIt One board. When I'm listening for the piezo buzzer for expected company, I flip this switch on.
6. For immediate use: go with wired. That is, wire your PIR sensor from your driveway detection point back to the LinkIt One. For this you will need to bury 18 gauge wire, 3-conductor, for the distance from the sensor to the microcontroller. I have used electric-fence wiring for dogs, as this is meant to be buried. Note, for future applications, take advantage of LinkIt One's wireless technology to beam only the signal to your smartphone or Wi-Fi router. I'm not doing this here in N.H. where it gets cold outside...you'd have to house your LinkIt One in a thermally protected box at the p.i.r. site.
Set Up the P.I.R. Sensor
Setup the P.I.R sensor by plugging into a 3-receptacle connector cable, like the one I have shown in the photo (which is way overkill, but as long as it has 3 conductors, it's ok) -- all you really need to do is pick up the 3 pins: Ground, VCC (3 to 6 VDC), and P0 which is the signal back to the LinkIt One....HIGH = movement, LOW = no movement.
NOTE: This particular model is ideal because it has 2 sensitivities: 30 feet (normal) and 15 feet (reduced) based on the jumper you set on the device.
Embed Sensor Inside Waterproof Housing
Note: although the Parallax literature says this p.i.r. sensor is best suited for indoor use, I believe as long as the weather is decent and you have embedded your sensor inside a durable (rainproof) housing, you should be all set.
Locate your p.i.r. sensor inside the housing you have selected to contain the p.i.r. sensor. Mine already has a lens. I have found that the signal is not attenuated much by leaving the lens in the housing, that is, embedding the lensed p.i.r. inside the lensed housing, though you may need to adjust the 15-ft to 30-ft jumper setting if you are not able to sense a moving car in front.
I used an older model housing from a cheapo diffuse IR detector (called driveway patrol)...I ripped out the guts of that one, and installed the Parallax p.i.r. sensor. This housing now allows me to nail it to the tree next to my driveway. If you have no trees next to yours, then you could possibly disguise your housing as a sprinkler head by painting it black and angling it upwards from the ground so that you will get cars as they drive past.
Attach Housing to Tree or Other "hiding Place"
As you can see in the photo, there is a convenient pine tree located next to my driveway with a notch already in it, so I simply drilled a few holes and attached it there. The wires are hidden from view and are embedded all the way back to my garage where I tucked the LinkIt One board on a shelf with a power outlet.
Wire It to LinkIt One
Since the p.i.r. sensor already conditions the signal for you, all you need to do is wire the P0 from the p.i.r. to a digital input that the code monitors when the 'Intruder Alert' switch has been turned on.
Wire the piezo buzzer to an available output. I'm assuming your evaluation board is performing more than just this task, after all, it's made for multi-tasking!
Wire the toggle switch to an available input on the board.
Wire GND to ground, and VCC to your 3-6VDC source for the p.i.r sensor.
Write Code and Execute!
Write a simple code for the LinkIt One that handles the following algorithm:
1. If toggle switch is ON, then:
a. Go into a forever loop to sense input P0 from p.i.r. sensor (sense your chosen input on LinkIt One).
2. If p.i.r. sensor input goes HIGH (means IR beam is triggered), then:
a. Sound the piezo buzzer's output for 5 seconds (any longer would be annoying), then shut off.
3. WAIT for 1 second, ignoring p.i.r. state (debounce)
4. Repeat 1.a. until toggle switch is OFF.
------------------------------------------------------------------------------
Code references:
void loop()
{ signal(); if(digitalinput == 1)
{ digitalWrite(Piezo, HIGH);
delay(1000);
digitalWrite(Piezo, LOW); }
-------------------------------------------------------------------------------