Arduino - Simple Security Idea.




About: Bytesize articles instead of a trilogy in one post.

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.

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

Step 2: 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.

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

PC (freebasic)
do until 0 <> 0
do until (res AND 64) = 6
res = INP(&H379)
rem 64 is for pin 10 if it goes high
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

Step 4: Test It.

It works!



    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest

    2 Discussions


    6 years ago on Introduction

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

    1 reply

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