adding a time interval to a PIR sensor

Hi all, Some of you may remember I wrote in a while ago about activating a 35000V stun gun with a PIR sensor using an UNO. I've got it all working, but can't seem to drop the amount of time the stun gun fires below 4 seconds. Does anyone have any suggestions as to how to go about doing this? Thanks

Motion detected= LED on for 1sec, 2sec, 3sec.......etc..... no motion LED off

Well, we can't see your code or any details of your project, so suggestions would be "post it".

Hi,

If the sensor is like this one:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=173

That little orange pot is a minimum time when fully Counter Clockwise. But that may still be too long??

So, in code, wait for the sensor to come on, fire the Whatever for however long you want, then wait for the sensor to go OFF, then repeat??

I was offered this suggestion in the past and used this to get everything up and running http://www.ladyada.net/learn/sensors/pir.html

The only alteration I made that enables some control over the gun firing time is an added delay(10); as seen below (this allows for the 4 sec. firing time) /* * PIR sensor tester */

int ledPin = 13; // choose the pin for the LED int inputPin = 2; // 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 delay (10); 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; delay (10); } } 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; } } }

Does the PIR sensor put out too much power to drop the time? is that a silly question? I'm a novice at best when tackling these issues.

Thanks all

Does the PIR sensor put out too much power to drop the time? is that a silly question?

It could be - what does it mean?

I believe the PIR has a default refractory period which results in the minimum 4 second firing time for the gun. How can I alter that?

I guess what you need is explained in the ladyada article. (Changing pulse time and timeout length)

The Pir sensor works with two intervals, the time the output stays high after detection and the time it waits before it starts detecting again. Those are controlled by capacitor and resistor. By changing the values of the capacitor/resistor of the specific interval you can make it longer/shorter.