Can we use other pin as an interrupt to wake Arduino Uno from sleep ?
2 Answers
It's not just Pin 2 that can wake from sleep. Depending on which sleep mode you are in different interrupts (both internal and external) can wake the chip up.
The datasheet contains this helpful table:
The external interrupts (pins 2 and 3 on the Uno, and only "Level" trigger mode), pin change interrupts, I2C address matching, and the watchdog are the only interrupts that can wake the chip from any sleep mode. Other interrupts only work in certain sleep modes since they require parts of the chip to still be running in order for the interrupt to fire.
So that means that yes you can use any pin you like (using the "Pin Change" Interrupts) to wake the chip.
-
Thank you Majenko for your answer. Actually, in my project, I'm using the EnableInterrupt library (github.com/GreyGnome/EnableInterrupt) which enable to extend the interrupt functionality to multiple pins in the Uno, do you think that this will help to use other pins in the Uno to wake up using interrupts ? Commented Jun 3, 2017 at 10:57
-
That is just a fancy wrapper for the Pin Change interrupts, so yes, it will wake the chip.– MajenkoCommented Jun 3, 2017 at 10:58
I think you also can use pin 3 (INT1), see link
There are two interrupts:
- INT0, pin 2
- INT1, pin 3
According to the link (among other techniques), an external interrupt can be used, so both INT0 and INT1 should be valid.