loading

If you are like me and don't like to throw away junk electronic items, you may have an old PIR sensor from an ordinary house alarm at the bottom of your junk box.

You can easily hook it up to your arduino to detect movement by simply making use of the LED on the PIR which turns on when movement was detected.

They usually run with a 12v power source.

Check the next step to see how its connected..

Step 1: Connecting the PIR to Your Arduino.

In my case I'm making use of 2 different power sources.

The Arduino is connected to my PC via USB (Not Shown in the Picture) and the PIR is connected to a 12V Power source.

This means that both the Arduino and PIR's GND needs to be joined, otherwise the Arduino will not detect an input from the PIR. (Joining the GND allows the little amount of voltage from the PIR to run via the input pin to GND)

But to simply it , Its better to use the same power source which will be less confusing.

I'm basically powering both the arduino and PIR and then simply connect the LED on the PIR, with a wire which I have soldered to the back of the PIR sensor, the LED then connects to PIN 8 on the arduino (Be sure to put a resistor in between the PIR's LED and the Arduino's Digital Pin 8)

Step 2: Creating the Code.

The Arduino code is simple and easy to understand.

int PIRInput = 8;
int ledPin = 13;
int PIRState; void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(PIRInput, INPUT);
}
void loop()
{
PIRState = digitalRead(PIRInput);
if (PIRState==HIGH)
{
digitalWrite(ledPin, LOW);
}
else
{
digitalWrite(ledPin, HIGH);
}
}

How it works.

Once the PIR detect's movement, it will turn on its own on board LED which has enough power for the Arduino's digital read feature to detect voltage.

Once the Arduino has detected an incomming signal it simply turns on its own internal built in LED on pin 13.

Off-coarse now you can change the code to do what ever you want it to do.

Step 3: Watch the Video for Better Clarity.

Watch a demonstration of this video.

Hope you enjoyed my instructable.

Step 4:

<p>hello, greetings from Chile.</p><p>my question it`s about how many ohm`s the resistor must have?</p>
I buy up cheap wireless PIRs when systems go obsolete, &amp; they run off ~3V dc, so you could try those instead. Should make your life simpler.

About This Instructable

7,251views

127favorites

License:

More by mviljoen2:Arduino Controlled Seed Incubator Jerrycan mount with parts bought from a hardware store. How to nativly run Netflix on a raspbery PI2  
Add instructable to: