Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: PIR works with polling, not with interrupt
PostPosted: Sat Mar 10, 2012 8:31 pm 

Joined: Sat Mar 10, 2012 7:55 pm
Posts: 3
Hi,
I am trying to get interrupt from PIR sensor to my waspmote through event sensor board. It seems to work when I read digital value from socket 7 but it never trigger interrupt.

The code I am using is the same as provided in a document and a libelium-dev guy in another thread. Here it is:
/*************************/
int value = 0;

void setup()
{
SensorEvent.setBoardMode(SENS_ON);
USB.begin();
USB.println("Start");
SensorEvent.attachInt();
}

void loop()
{
SensorEvent.attachInt();
PWR.sleep(UART0_OFF | UART1_OFF | BAT_OFF | RTC_OFF);
SensorEvent.detachInt();
SensorEvent.loadInt();
USB.begin();
USB.println(SensorEvent.readValue(SENS_SOCKET7));
delay(3000);
if (SensorEvent.intFlag && SENS_SOCKET7)
{
Utils.blinkLEDs(1000);
USB.println("PIR interruption");
}
SensorEvent.intFlag = 0;
}
/*************************/
But unfortunately I could not get anything out of it. Can any body help please


Top
 Profile  
 
 Post subject: Re: PIR works with polling, not with interrupt
PostPosted: Mon Mar 12, 2012 9:54 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7479
Hi bluesmoke,

there is a mistake in your code, could you try replacing this line

Code:
if (SensorEvent.intFlag && SENS_SOCKET7)


by this one?

Code:
if (SensorEvent.intFlag & SENS_SOCKET7)


Regards.


Top
 Profile  
 
 Post subject: Re: PIR works with polling, not with interrupt
PostPosted: Mon Mar 12, 2012 8:37 pm 

Joined: Sat Mar 10, 2012 7:55 pm
Posts: 3
Hi Libelium_dev,

I fixed that mistake and replaced the logical AND operator with bitwise as you suggested but the result is same unfortunately.

Regards,


Top
 Profile  
 
 Post subject: Re: PIR works with polling, not with interrupt
PostPosted: Tue Mar 13, 2012 12:59 pm 

Joined: Sat Mar 10, 2012 7:55 pm
Posts: 3
I tested PIR with voltmeter. It gives about 1.75V when detect presence.
One strange thing I observed is when I place the voltmeter probes over GND and VOUT pins of connector 7 (where PIR is attached) it starts triggering interrupt on movement over PIR. And when I remove the probes it stop responding again. I have tried with two PIR sensors and two event sensor boards..no success yet :(


Top
 Profile  
 
 Post subject: Re: PIR works with polling, not with interrupt
PostPosted: Mon Mar 19, 2012 11:04 am 

Joined: Mon Sep 28, 2009 1:06 pm
Posts: 7479
Dear bluesmoke,

The sensors seem to be faulty, so we will be handling this via the Technical Service.

Best regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use