Now when the PIR detects motion, the output pin will go "high" to 3.3V and light up the LED!
Once you have the breadboard wired up, insert batteries and wait 30-60 seconds for the PIR to 'stabilize'. During that time the LED may blink a little. Wait until the LED is off and then move around in front of it, waving a hand, etc, to see the LED light up!
There's a couple options you may have with your PIR. First up we'll explore the 'Retriggering' option.
Once you have the LED blinking, look on the back of the PIR sensor and make sure that the jumper is placed in the L
position as shown below.
Now set up the testing board again. You may notice that when connecting up the PIR sensor as above, the LED does not stay on when moving in front of it but actually turns on and off every second or so. That is called "non-retriggering".
Now change the jumper so that it is in the H position. If you set up the test, you will notice that now the LED does stay on the entire time that something is moving. That is called "retriggering".
(The graphs above are from the BISS0001 datasheet, they kinda suck)
For most applications, "retriggering" (jumper in H position as shown below) mode is a little nicer.
If you need to connect the sensor to something edge-triggered, you'll
want to set it to "non-retriggering" (jumper in L position).
The Adafruit PIR has a trimpot on the back for adjusting sensitivity. You can adjust this if your PIR is too sensitive or not sensitive enough - clockwise makes it more sensitive.
Changing Pulse Time and Timeout Length
There are two 'timeouts' associated with the PIR sensor. One is the "Tx
" timeout: how long the LED is lit after it detects movement - this is easy to adjust on Adafruit PIR's because there's a potentiometer.
The second is the "Ti
" timeout which is how long the LED is guaranteed to be off when there is no movement. This one is not easily
changed but if you're handy with a soldering iron it is within reason.
First, lets take a look at the BISS datasheet again
On Adafruit PIR sensors, there's a little trim potentiometer labeled TIME.
This is a 1 Megaohm adjustable resistor which is added to a 10K series resistor. And C6
is 0.01uF so
Tx = 24576 x (10K + Rtime) x 0.01uF
If the Rtime potentiometer is turned all the way down counter-clockwise (to 0 ohms) then
Tx = 24576 x (10K) x 0.01uF = 2.5 seconds (approx)
If the Rtime potentiometer is turned all the way up clockwise to 1 Megaohm then
Tx = 24576 x (1010K) x 0.01uF = 250 seconds (approx)
If RTime is in the middle, that'd be about 120 seconds (two minutes) so you can tweak it as necessary. For example if you want motion from someone to turn on a fan for a minimum of 1 minute, set the Rtime potentiometer to about 1/4 the way around.
For older/other PIR sensors
If you have a PIR sensor from somewhere else that does not have a potentiometer adjust, you can trace out the adjustment resistors this way:
Determining R10 and R9 isnt too tough. Unfortunately this PIR sensor is mislabeled (it looks like they swapped R9 R17). You can trace the pins by looking at the BISS001 datasheet and figuring out what pins they are - R10 connects to pin 3 and R9 connects to pin 7. the capacitors are a little tougher to determine, but you can 'reverse engineer' them from timing the sensor and solving!
Tx is = 24576 * R10 * C6 = ~1.2 seconds
R10 = 4.7K and C6 = 10nF
Ti = 24 * R9 * C7 = ~1.2 seconds
R9 = 470K and C7 = 0.1uF
You can change the timing by swapping different resistors or capacitors. For a nice tutorial on this, see Keith's PIR hacking page.