Correct use of pir sensor on the Arduino board

I’m posting this topic even if i saw that was already treated because i never found this kinf of problem. my pir sensor, when i connect it to arduino starts to send input in a regular time, (something like 2 seconds) without anything moving in front on it, or even without something in front on it. After seeing it i tried to calibrate it with the sketch that i found on this forum and something that i saw also on Google, but it never worked correctly…or for better saying the loop never started, because after the compilation the calibration started and finished everytime after 30 seconds without doing anything else. when i changed the pause time of the function it started to give regular input again without any sense…So my question is: How can i calibrate it correctly and after make it give input only if something move in front on it?

Just to make things easier i’ll post below the sketchs that i used:

byte pirPin =2;
byte ledPin= 13;

void setup() {
  pinMode(pirPin, INPUT);
  pinMode(ledPin, OUTPUT);
  
 }
 
void loop(){
  if (digitalRead(pirPin)==LOW) {
    digitalWrite (ledPin, HIGH); 
  }else (digitalWrite(ledPin, LOW));
    
 }


this is the second one

int calibrationTime= 30;

long unsigned int lowIn;

long unsigned int pause = 5000;

boolean lockLow = true;
boolean takeLowTime;

int pirPin = 3;
int ledPin= 13;

void setup() {
  Serial.begin(9600);
  pinMode(pirPin, INPUT);
  pinMode(ledPin, LOW);
  
  Serial.print("sensor calibration ");
   for (int i=0; i< calibrationTime; i++) {
     Serial.print(".");
     delay(1000);
     }
     Serial.println ("done");
     Serial.println ("sensor active");
     delay(50);
    }
void loop(){
  if (digitalRead(pirPin) == HIGH) {
    digitalWrite(ledPin, HIGH);
    if (lockLow) {
      lockLow = false;
      Serial.println("---");
      Serial.print("movement detected at ");
      Serial.print(millis()/1000);
      Serial.print(" sec");
      delay (50);
      }
      takeLowTime = true;
      }
  if(digitalRead(pirPin) == LOW) {
    digitalWrite(ledPin, LOW);
    
    if(takeLowTime) {
      lowIn = millis();
      takeLowTime = false;
     }
    if(!lockLow && millis()- lowIn > pause) {
      lockLow = true;
      Serial.print ("movement finished at ");
      Serial.print (millis() - pause/1000);
      Serial.print (" secondi");
      delay(50);
      }
      }
      }

and this is the third and last one

const int ledPin = 13;
const int inputPin = 3;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(inputPin, INPUT);
  
  }

void loop() {
  int val = digitalRead(inputPin);
  if (val == HIGH)
  {
    digitalWrite(ledPin, HIGH);
    delay(500);
    digitalWrite(ledPin, LOW);
    }
   }

none of those worked as expected

thanks to everyone for the attention

Is there nothing on the maker's website?

If it is this one: http://www.ebay.com/itm/1pcs-HC-SR501-Adjust-IR-Pyroelectric-Infrared-PIR-Motion-Sensor-Detector-Module-/380744781714?pt=LH_DefaultDomainjavascript:void(0);_0&hash=item58a6284f92 .. it is defective. I got three of theese.. one works..