Energy efficiency of interrupted sleep
-
My next sensor will check if the aircon is on or not by checking reed switch. As this status does not change very frequently and there is no urgency in knowing that it changed, I have two ways of doing it:
- checking the reed status every minute and between checks gw.sleep(SLEEP_TIME)
- connecting the reed to digital 3 and waking up using gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
these are going to be battery powered. I expect no more then 10 changes a day. Is there a power consumption price to pay for waiting on interrupt?
-
I don't see any disadvantage in using the interrupt. 10 times per day is much less than 86,400 minutes
However, if the aircon is fixed installed --- Why not powering the node with a bulk phone charger or so? You should have AC Mains near by...
-
@rvendrame no, they are wired directly to the circuit breaker board.
As in both cases the sensors will spend 99.999999% of their time sleeping, my question was if there is a difference in power consumption between "deep sleep" and "waiting for interrupt" sleep. I wouldn't think there is but trying to make sure.
-
@Moshe-Livne I don't expect it to make a difference. According to the ATmega328 datasheet (pg 40) all sleep modes support both INT0/INT1 and WDT as a wake-up source. WDT is used by MySensors to implement the sleep()-method.
And when in doubt, just measure it yourself to be sure!Btw. Better use level-triggered interrupt to wake the ATMega from sleep, to stick to the datasheet!
-
@Yveaux my ucurrent is swimming across the pond as we speak....
Thanks for checking this for me - I can't read these datasheets. Not sure about the last part of your reply. In what way is it better?
-
@Moshe-Livne said:
In what way is it better?
The datasheet states that to wake an ATMega from sleep from a PIN0/1 interrupt it should be configured as LEVEL interrupt, not CHANGE (second parameter to gw.sleep() )
It is likely to work when configured for CHANGE, but under certain conditions the interrupt may not be detected correctly by the ATMega.