PIR Sensor: LED keeps blinking non-stop although no detection

I bought Pyroelectric Infrared PIR Motion Sensor Detector Module from Amazon and wished to try it out. Once I received, I search PDF and found this: http://learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity-motion-sensor.pdf. I use the code and circuit as this PDF stated. Once I uploaded it. LED keeps blinking although no motion is detected. How can I fix this? I've tried two of them but still same result.

please post

  • the code you actually used
  • a link to the IR sensor datasheet

Is yours that actual adafruit product? If not, not much point in the pdf, since the actual sensor itself is surrounded by loads of electronics.

If it isn't that one, you need to post details of yours.....

This is the code

int ledPin = 2; // choose the pin for the LED
int inputPin = 3; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare sensor as input
Serial.begin(9600);
}
void loop(){
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH); // turn LED ON
if (pirState == LOW) {
// we have just turned on
Serial.println("Motion detected!");
// We only want to print on the output change, not state
pirState = HIGH;
}
} else {
digitalWrite(ledPin, LOW); // turn LED OFF
if (pirState == HIGH){
// we have just turned of
Serial.println("Motion ended!");
// We only want to print on the output change, not state
pirState = LOW;
}
}
}

And here is how I connect the circuit. (However, I did not use adafruit product, I am using: http://www.amazon.com/Pyroelectric-Infrared-Motion-Sensor-Detector/dp/B008AESDSY/ref=sr_1_1?s=electronics&ie=UTF8&qid=1409503920&sr=1-1&keywords=pir+sensor)

You might be getting false highs on your input because you don't have a pulldown resistor. The pin might not be low just because the sensor didn't make it high.

This example shows a pulldown to keep a pin low when a switch doesn't pull it high: your sensor is the switch in your case.

BTW your schematic doesn't show a current limiting resistor in series with the LED.

JimboZA:
You might be getting false highs on your input because you don't have a pulldown resistor. The pin might not be low just because the sensor didn't make it high.

This example shows a pulldown to keep a pin low when a switch doesn't pull it high: your sensor is the switch in your case.

BTW your schematic doesn't show a current limiting resistor in series with the LED.

It works now! Thank you. You are right I did not have resistor on LED because I planned to shrink the project as much as possible, ended up I did not put resistor on.

Er , Generally speaking, there are 2 protentiometers on the back of the module, to adjust the duration time and sensitivity.

Elecrow:
Er , Generally speaking, there are 2 protentiometers on the back of the module, to adjust the duration time and sensitivity.

It's not "generally speaking" at all.... mine doesn't, for example. Mine has neither pots nor jumpers to set the mode.

It depends entirely on how the manufacturer designs the raw sensor into a module.