Thanks for the answers, here are the requested details:
1) The LowPower arduino library is the following:
http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/2) I want to sleep more than 8s since I need to read the sensors once every 5mn (but during this sleep time, the PIR should be able to interrupt the sleep and put the arduino back to sleep)
3) I think the library is using: SLEEP_MODE_PWR_DOWN
From what I have read, is it possible that I am in the following situation:
Warning Code like this, which is a typical example of sleep code, can cause a problem if you are relying on the interrupt to wake you from sleep: (this is typically what is done when yopu are using the LowPower library since I call the attachInterrupt function, the call LowPower.powerDown(...) function):
attachInterrupt(0, pin2_isr, LOW);
/* 0, 1, or many lines of code here */
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
cli();
sleep_enable();
sleep_bod_disable();
sei();
sleep_cpu();
/* wake up here */
sleep_disable();
"The problem is if the interrupt occurs after attachInterrupt but before sleep_cpu(). The ISR will run, the interrupt will be detached, and then the CPU will enter sleep mode with no interrupt enabled. The MCU will never wake up this way. Fortunately there is a solution. The sleep enable bit can be cleared during the ISR and thus the MCU will not go to sleep. "
And that means the library should be modified to take into account this kind of situation, or that I should write directly the piece of code without relaying on this library, no?
Even if I could fall in this situation sometimes ... I cannot get why the behavior I have happens all the time.
So, what do you think I should do? (the power consumption I have noticed is not the main issue, so let's focus on the interrupt and sleep for 5mn issue first). Thanks.