Author Topic: LowPower and RFM69 receive interrupt  (Read 1981 times)

tavalin

  • Newbie
  • *
  • Posts: 3
LowPower and RFM69 receive interrupt
« on: February 13, 2015, 10:30:21 PM »
Hi all,

I'm trying to reduce the energy consumption of my RFM69 node.  What I'm trying to achieve is that the node runs in low power mode (power down) between sending transmissions every x seconds. I'd also like it to come out of low power mode if it receives a message or ack in order to process it and then go back to low power mode.

I had tried to use the built in interrupt on D2 but it seems like the library depends on this so I didn't want to override the interrupt handling method.  I've looked at MotionMote example which uses an interrupt on D3, would I be able to connect D2 and D3 and then create the interrupt on D3 so I can create my own additional handler for the interrupt?

Any tips or feedback appreciated.

Thanks,
Daniel

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5992
  • Country: us
    • LowPowerLab
Re: LowPower and RFM69 receive interrupt
« Reply #1 on: February 14, 2015, 09:03:00 PM »
Daniel,
Always keep interrupts separate. There are 2 hardware interrupts on the atmega328/Moteino - D2 and 3. D2 is used by radio, if included on Moteino. So you're left with D3, use it as shown in the MotionMote code. You can always use any other pin as a pin change interrupt but then you have to check which pin caused the interrupt. That's all.

tavalin

  • Newbie
  • *
  • Posts: 3
Re: LowPower and RFM69 receive interrupt
« Reply #2 on: February 15, 2015, 03:40:58 PM »
Hi Felix

Having read and thought about your reply (which initially confused me) I've now realised that even though the library handles the interrupt 0, it will still wake my loop code that is/was blocked at powerDown().

I was under the assumption that I had to implement my own interrupt for this to happen.

Thanks for your help.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5992
  • Country: us
    • LowPowerLab
Re: LowPower and RFM69 receive interrupt
« Reply #3 on: February 15, 2015, 05:08:41 PM »
Interrupts will wake the MCU, run any interrupt that was configured for that particular type of interrupt, and then resume execution from where it left of before sleeping. Then you have the option to put it back to sleep if you want to.