Introduction: Arduino - Simple Security Idea.

Picture of Arduino - Simple Security Idea.

What I wanted was a simple motion sensor that I could use semi-remotely. You can get airfresheners, pir sensors and all kinds of things to work, but I wanted something simple and cheap that could be used remotely. Pir sensors cost close to ten dollars each retail. Harbor freight had a whole setup for just ten dollars (on sale) for the price of a pir sensor, so I could not pass it up. 

Note: Try this at your own risk. Get a professional to help if you are unsure.

Update: There is now a product from Seeed that is a clone of the arduino. Stores are discounting the regular arduino simce the Seeeed items are about half the cost of the Arduino.

Step 1: What's Needed.

Picture of What's Needed.

Arduino.
LDR.
1K resistor.
Wire.
Black tape.
Driveway Alert system.
3 "C' cell batteries
1 9V battery
Moc
2 - 330 ohm resistors
1 - 3k resistor
Breadboard for testing
1 parallel port break out cable.

Step 2: Main Circuits.

Picture of Main Circuits.

There are two circuits here. One from the Arduino to the receiver and the other from the Arduino to the pc. I did not want to have to deal with rs232 circuits so just a simple signal to the parallel port should do the job.

Note: resistor from the Arduino to the MOC could be as low as 330 ohms.

Step 3: The Code.

Picture of The Code.

Arduino
[code]
int ldr = 0;             //analog pin to which LDR is connected
int ldr_value = 0;        //variable to store LDR values
int ledPin = 12;  

void setup()
{
pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  ldr_value = analogRead(ldr);          //reads the LDR values
  if (ldr_value > 50)
     {
      delay(50);                  //wait
      digitalWrite(ledPin, HIGH);   // sets the LED on
      delay(5000);                  // waits for 5 seconds before rearming
      digitalWrite(ledPin, LOW);    // sets the LED off
     }
}
[/code]

PC (freebasic)
[code]
do until 0 <> 0
do until (res AND 64) = 6
res = INP(&H379)
rem 64 is for pin 10 if it goes high
loop
rem execute whatever code you want to let you know there was motion.
rem bti sends a twitter to the set up account.
shell "echo  there was motion | bti"
rem Timing loop before rearming.
for z = 1 to 500000
next z
loop
[/code]


Step 4: Test It.

Picture of Test It.

It works!

Comments

AustinJim (author)2013-04-04

Hi, thanks for the project. Why not communicate with the PC over the usb port of the Arduino instead of the parallel port?
Jim

Computothought (author)AustinJim2013-04-17

Thanx. Do not want to over tax the ussb port. Less electronics required and easiier to program than the usb.,.

About This Instructable

6,138views

17favorites

License:

Bio: computoman.blogspot.com Bytesize articles instead of a trilogy in one post.
More by Computothought:Coffeepot mealsEasy sun hatEasy cakes and pies.
Add instructable to: