MBed + PIR from cool components

20 Nov 2010 . Edited: 20 Nov 2010

Afternoon,

 

Im having a little trouble with the PIR from cool components, http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=312&osCsid=j90j5kqfegquksdbumahtmuqg5

 

I have set the pin to pull up and passing 5v to it.

 

When the PIR detects movement its goes Low on the alarm wire (the black one!), I have attached this to pin 19 and using the code below it lights LED1 and also shows output on a meter.

 

Im getting a strange output from the PIR, if its left alone the pin is High, as you would expect, when it dectect movement it goes Low and then flaps between low and high for a few seconds, waits then does it again.  It repeats this process for about a minute then stops and is back in High.

 

If you interupt the random process it stays Low.

 

I can't figure it out is there something im missing?

 

 

AnalogOut cpum(p18); 
DigitalOut LED(LED1);
DigitalIn PIR(p19);


int main() {

PIR.mode(PullUp);
while(1) {

 if (!PIR){
        LED=1;
        //wait(0.25);
    }else{
        LED=0;
    }
    
    cpum.write(PIR);

}

}
22 Nov 2010

Did you use a pull down resistor on the black wire? I used analog input, and it works fine.

13 May 2011

I figured this out a while ago and never responded.

The Infra red fire detector at work was interfering with my PIR