pir sensor problem

Hi there,
wondering if anyone can help me with this problem...

I'm using a PIR sensor (link to the specific one I have below) to trigger two relays controlling a light and a speaker. I want the light to flash and the speaker to play sound when there is NO motion, and then to turn off when there is motion detected, and stay off until there is no motion again. This seems to be working fine some of the time, but sometimes (not always!) the sound and light come back on while there is still someone in front of the sensor. I have the jumper in the H position (repeatable mode I think), and I have the sensitivity potentiometer all the way clockwise (highest sensitivity) and the delay one all the way counter-clockwise (shortest delay).

if anyone has any ideas about what I might be doing wrong please help!

here's the code I'm using:

int light = 3;
int speaker = 4;
int pirSensorPin = 2;

int motionDetected = LOW;

void setup() {
pinMode(light, OUTPUT);
pinMode(pirSensorPin, INPUT);
pinMode(speaker, OUTPUT);
Serial.begin(9600);
delay(5000);
}

void loop(){
motionDetected = digitalRead(pirSensorPin);
if(motionDetected == LOW)
{
digitalWrite(speaker, HIGH);
digitalWrite(light, HIGH);
delay(300);
digitalWrite(speaker, HIGH);
digitalWrite(light, LOW);
delay(200);
}
digitalWrite(light, LOW);
digitalWrite(speaker,LOW);
}

and here's the sensor:

mclacey:
sometimes (not always!) the sound and light come back on while there is still someone in front of the sensor.

Tell that person to continue to dance. The sensor detects motion, not presence.

it happens even when a person is moving in front of it though. is there a sensor you know of that detects presence?

ok I actually now have it working better - i’ve adjusted the delay on the sensor up to about 15 seconds. The only problem with this is now that it the light and speaker dont go back on until 15 seconds after motion has stopped. Is there a way I can make this more instant?

mclacey:
it happens even when a person is moving in front of it though. is there a sensor you know of that detects presence?

Detecting presence is hard, much harder than motion.

Maybe you can use an IR camera, look for a big bright spot. Warm objects, including people, can be seen this way.

mclacey:
ok I actually now have it working better - i've adjusted the delay on the sensor up to about 15 seconds. The only problem with this is now that it the light and speaker dont go back on until 15 seconds after motion has stopped. Is there a way I can make this more instant?

Turning back the pot is the only way to make it react faster on absence of movement.