PIR Sensor Module SE-10 Question

Hello all,

I'm new to elecronics/Arduino world and have a few questions about my PIR sensor. I have the SE-10 PIR sensor from sparkfun and I'm trying to set it up as a trigger for my camera. I would like to use it to catch birds or prey swopping down to catch bait.

I am currently using the setup from this page, and also using the code as a guide.

My first question involves I problem that when I run my code, sometimes it seems like the sensor get's "stuck" in the on position after it's initial trigger. I've noticed that the shorter the delay between my analogread's the more likely this occurs. Other times it almost seems random to me. Is this normal for PIR sensors? Do the need time to get rid of a charge or something similar? I've tried tweaking the delay and assigning the int. a high value after the intial trigger to try and avoid this problem without luck. I would like the sensor to trigger as soon as motion happens. Anyone have an ideas on how to do this?

My second question involves the difference between analog and digital input with PIR sensors. I've looked at other sites using a PIR to trigger a camera, and they are use digital in, instead of analog in. I've tried using the digital input with my PIR but it didn't seem to work at all. Are PIR sensors made specifically to be either digital or analog? Or can they be used in both methods? Here are the setups I've tried for digital Input.

Here's the code I'm currently trying.

int alarmPin = 0;
int alarmValue = 0;
int ledPin = 13;

void setup () {
pinMode(ledPin, OUTPUT);
pinMode(alarmPin, INPUT);

Serial.begin (9600);
delay (2000); // Allow time for sensor to calibrate
Serial.print ("SensorReady");
}

void loop (){
alarmValue = analogRead(alarmPin);
//If motion is detected
if (alarmValue < 100){
Serial.print ("Motion!");
digitalWrite(13,HIGH); //Turn LED for visual cue that it detected motion
alarmPin = 1000; //Set the value to try and avoid it from continually going off?
delay(200);
digitalWrite(13,LOW);
delay(2000); //Allow time for it to reset?
}
delay(100);
Serial.println (alarmValue);
}

Sorry the forum wouldn't let me post the links without having a normal non-link message first.

Here's the link to my set up and code reference.
http://itp.nyu.edu/physcomp/sensors/Reports/PIRMotionSensor

And here's a few examples of teh digital input i've tried without luck.
http://www.ladyada.net/learn/sensors/pir.html
http://luckylarry.co.uk/arduino-projects/arduino-motion-triggered-camera/

Hey hey,

I've just bought the same PIR sensor, and I get the same issues ... and the same questions !

It seems to be extremely random.

Did you find the solution by yourself ?

I'd like to know so I can go ahead :slight_smile:

why not try this

int alarmPin = 0;
int alarmValue = 0;
int ledPin = 13;

void setup () {
  pinMode(ledPin, OUTPUT);  
  pinMode(alarmPin, INPUT);
  
  Serial.begin (9600);
  delay (2000); // Allow time for sensor to calibrate
  Serial.print ("SensorReady");
}

void loop (){
  alarmValue = analogRead(alarmPin);
  //If motion is detected
  if (alarmValue == LOW){
   Serial.print ("Motion!");
   digitalWrite(13,HIGH); //Turn LED for visual cue that it detected motion
delay(1000); // 1 second delay before it's turning off
digitalwrite(13, LOW);
   else{
      digitalWrite(13, LOW);
  }
}

the PIR sensor is made for digital outputs(if it's detecting motion the alarm pin goes LOW)

I am currently using the setup from this page, and also using the code as a guide.

hmm i dont see any link there you probably provided the link but the forum dosent allow you to use links in the first post :wink:
we can tell something once you post the link now